Previous Page
Next Page

fputc

Writes a character to a file

#include <stdio.h>
int fputc ( int c , FILE *fp  );

The fputc( ) function writes one character to the current file position of the specified FILE pointer. The return value is the character written, or EOF if an error occurred.

Example

#define CYCLES 10000
#define DOTS 4

printf("Performing %d modulo operations ", CYCLES );
for (int count = 0; count < CYCLES; ++count)
  {
    if ( count % ( CYCLES / DOTS ) != 0) continue;
    fputc( '.', stdout );            // Mark every nth cycle
  }
printf( " done.\n" );

This code produces the following output:

Performing 10000 modulo operations .... done.

See Also

putc( ); fgetc( ), fputwc( )


Previous Page
Next Page