fgetc

get the next character from a file

Synopsis:

#include <stdio.h>
int fgetc( FILE *fp );

Description:

The fgetc() function gets the next character from the file designated by fp. The character is signed.

Returns:

See also:

errno, fgetchar(), fgets(), fopen(), getc(), gets(), ungetc()

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

Systems:

All (except DOS/PM)