fgetc

Returns the next character from the input stream

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

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

Parameters

fp
(IN) Points to the file.

Return Values

The fgetc function returns the next character from the input stream pointed to by fp. If the stream is at end-of-file, the EOF indicator is set and fgetc returns EOF. If a read error occurs, the error indicator is set and fgetc returns EOF. If an error occurs, errno is set.

Remarks

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

See Also

fgets, fopen, getc, gets, ungetc

fgetc Example

  #include <stdio.h>  
   
  main ()  
  {  
     FILE   *fp;  
     int    c;  
     fp = fopen ("data.fil", "r");  
     while ( (c = fgetc (fp) ) != EOF)  
        putchar (c);  
     fclose (fp);  
  }