[Previous]
[Contents]
[Next]

fputc()

write a character to an output stream

Synopsis:

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

Description:

The fputc() function writes the character specified by the argument c to the output stream designated by fp.

Returns:

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.

Examples:

#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 );
    }
  }

Classification:

ANSI

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

errno, ferror(), fopen(), fputchar(), fputs(), putc(), putchar(), puts()


[Previous]
[Contents]
[Next]