曲径通幽论坛

标题: isprint() --- 判断字符是否可以打印 [打印本页]

作者: beyes    时间: 2010-9-2 21:38
标题: isprint() --- 判断字符是否可以打印
函数原型
#include <ctype.h>
int isprint(int c);

说明
isprint() 函数用来判断一个字符是否可以打印。如果可以,则返回非 0 值;否则,返回 0.

测试程序
#include <ctype.h>
#include <stdio.h>

int main()
{
     int c;
     c = 'x';
     if (isprint(c))
         printf ("c is a printable character.\n");
     
     c = 0x80;
     if (!isprint(c))
         printf ("c is not a printable character.\n");

     return (0);
}
运行与输出
$ ./isprint
c is a printable character.
c is not a printable character.





欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2