uTools-Manuals/docs/c/toascii.html
2019-04-21 11:50:48 +08:00

38 lines
876 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1>字符函数 - toascii</h1>
<p>原型extern int toascii(int c);</p>
<p>用法:#include &lt;ctype.h></p>
<p>功能将字符c转换为ascii码</p>
<p>说明toascii函数将字符c的高位清零仅保留低七位。返回转换后的数值。</p>
举例:<pre><code class="language-c">
// toascii.c
#include &lt;syslib.h>
#include &lt;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>相关函数:无