Definition | #include <stdio.h> int putc(int c, FILE *fp);
| |
Return val. | The written character c | |
if successful. | ||
EOF | otherwise. | |
Notes |
The characters are not written immediately to the external file but are stored in an internal Control characters for white space (\n, \t, etc.) are converted to their appropriate effect when | |
Example | The following program reads characters from the standard input and writes them to the file #include <stdio.h> FILE *fp; int c; int main(void) { fp = fopen("fnam","w"); while((c=getchar()) != EOF) putc((char)c,fp); fclose(fp); return 0; } | |
See also | fputc, printf, putchar, fopen, fopen64, putwc |