write a character to an output stream
#include <stdio.h> int fputc( int c, FILE *fp );
The fputc() function writes the character specified by the argument c to the output stream designated by fp.
The character written, or EOF if a write error occurs. When an error has occurred, errno indicates the type of error that has been detected.
#include <stdio.h>
void main()
{
FILE *fp;
int c;
fp = fopen( "file", "r" );
if( fp != NULL ) {
while( (c = fgetc( fp )) != EOF )
fputc( c, stdout );
fclose( fp );
}
}
ANSI
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
errno, ferror(), fopen(), fputchar(), fputs(), putc(), putchar(), puts()