mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 15:04:05 +08:00
38 lines
876 B
HTML
38 lines
876 B
HTML
<h1>字符函数 - toascii</h1>
|
||
|
||
|
||
<p>原型:extern int toascii(int c);</p>
|
||
|
||
<p>用法:#include <ctype.h></p>
|
||
|
||
<p>功能:将字符c转换为ascii码</p>
|
||
|
||
<p>说明:toascii函数将字符c的高位清零,仅保留低七位。返回转换后的数值。</p>
|
||
|
||
举例:<pre><code class="language-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;
|
||
}
|
||
|
||
</code></pre>相关函数:无
|
||
|