mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-08 15:04:05 +08:00
43 lines
797 B
HTML
43 lines
797 B
HTML
<h1>输入输出 - putchar</h1>
|
||
|
||
|
||
<p>原型:extern void putchar(char c);</p>
|
||
|
||
<p>用法:#include <stdio.h></p>
|
||
|
||
<p>功能:在屏幕上显示字符c</p>
|
||
|
||
<p>说明:字符输出在屏幕的当前位置。</p>
|
||
可用move或gotoxy改变光标位置。
|
||
|
||
举例:<pre>
|
||
|
||
// putchar.c
|
||
|
||
#include <stdio.h>
|
||
#include <system.h>
|
||
|
||
#define CPR 14
|
||
|
||
main()
|
||
{
|
||
int i,j,k;
|
||
|
||
clrscr();
|
||
|
||
textmode(0x00);
|
||
for(i=1;i<6;i++)
|
||
{
|
||
k=i>3?(6-i):i;
|
||
move(i,CPR/2-k);
|
||
for(j=1;j<k*2;j++) putchar('*');
|
||
}
|
||
gotoxy(10,10); // Hide Cursor
|
||
|
||
getchar();
|
||
return 0;
|
||
}
|
||
|
||
</pre>相关函数:无
|
||
|