toascii

2018-11-11 15:20 更新

 原型:extern int toascii(int c);
 
 用法:#include <ctype.h>
 
 功能:將字符c轉(zhuǎn)換為ascii碼
 
 說(shuō)明:toascii函數(shù)將字符c的高位清零,僅保留低七位。返回轉(zhuǎn)換后的數(shù)值。
 
 舉例:


     // 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;
     }  


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)