字符函数 - toascii

原型:extern int toascii(int c);

用法:#include <ctype.h>

功能:将字符c转换为ascii码

说明:toascii函数将字符c的高位清零,仅保留低七位。返回转换后的数值。

举例:


      // toascii.c
      
      #include <syslib.h>
      #include <ctype.h>


      main()
      {
        char s[]="文曲星-BJGGV";
        int i=12;            // length of string s
        
        clrscr();            // clear screen
        textmode(0xE0);      // make sure LCD mode is 3 big line
        printf("%s\n",s);
        for(i=0;i<12;i++)
        {
          putchar(toascii(s[i]));
        }
        getchar();
        return 0;
      }      
      
  
相关函数:无