putch

putch

在當前游標處向螢幕輸出字元ch,然後游標自動右移一個字元位置。

基本信息

函式名: putch

用 法: int putch(int ch),其中參數ch為要輸出的字元。

返回值:如果輸出成功,函式返回該字元;否則返回EOF。

說明:非ANSI C標準

程式例

1:(VC6.0中運行通過)

/*putch例程*/

#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;

}

相關詞條

相關搜尋

熱門詞條

聯絡我們