putc()函数putc
语法:
1 2 |
?? #include <stdio.h> ?? int putc( int ch, FILE *stream ); |
putc()函数把字符ch写到stream(流)中. 返回值是写入的字符, 发生错误时返回EOF. 例如:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
#include <stdio.h> int main () { FILE *fp; int ch; fp = fopen("file.txt", "w"); for( ch = 33 ; ch <= 100; ch++ ) { putc(ch, fp); } fclose(fp); return(0); } |
显示”temp.cpp”的内容到屏幕.