在当前光标处向屏幕输出字符ch,然后光标自动右移一个字符位置。
在当前光标处向屏幕输出字符ch,然后光标自动右移一个字符位置。
函数名: putch
用 法: int putch(int ch),其中参数ch为要输出的字符。
返回值:如果输出成功,函数返回该字符;否则返回EOF。
说明:非ANSI C标准
1:(VC6.0中运行通过)
#include <stdio.h>
#include <conio.h>
int main(void)
{
char ch = 0;
printf("Input a string:");
while ((ch != 'r'))
{
ch = getch();
putch(ch);
}
return 0;
}
程序例2:(在TC下运行通过)
#include <stdio.h>
#include <conio.h>
int main()
{
int i;
char *ch="ok!welcome to here!";
textbackground(0);
clrscr();
for(i=1;i<8;i++)
{
window(10+i*5,5+i,30+i*5,15+i);
textbackground(i);
clrscr();
}
textcolor(RED);
clrscr();
cprintf(ch);
cputs(ch);
putch(3);
getch();
return 0;
}