This shows you the differences between two versions of the page.
c:stdio.h:fputchar [2013/01/22 22:02] |
c:stdio.h:fputchar [2024/02/16 01:05] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code c> | ||
+ | int fputchar( int c ); | ||
+ | </code> | ||
+ | === description === | ||
+ | The fputchar() function writes the character specified by the argument c to the output stream stdout. This function is identical to the putchar() function. | ||
+ | |||
+ | ===== example ===== | ||
+ | <code c> | ||
+ | #include <stdio.h> | ||
+ | |||
+ | int main( void ) | ||
+ | { | ||
+ | FILE *fp; | ||
+ | int c; | ||
+ | |||
+ | fp = fopen( "file.txt", "r" ); | ||
+ | if( fp != NULL ) { | ||
+ | c = fgetc( fp ); | ||
+ | while( c != EOF ) { | ||
+ | fputchar( c ); | ||
+ | c = fgetc( fp ); | ||
+ | } | ||
+ | fclose( fp ); | ||
+ | } | ||
+ | } | ||
+ | </code> |