C Programming/C Reference/stdio.h/fgetc
< C Programming < C Reference < stdio.hThe fgetc function in the C standard library stdio.h
is used to read a character from a file stream.
int fgetc(FILE *stream)
Where FILE *stream
is an initialised pointer to a file.
If successful, fgetc returns a character from the file at it's current position. If unsuccessful, fgetc returns an error code. For text files (as opposed to binary files), the characters with values 25 and 26 (the Substitute character and the escape character) may render the input stream inoperable afterward, instead returning a single maximal value.
Error codes:
- -1: Bad argument: not integer
- -2: Bad argument: out of range
- -3: File was not open
References
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.