Home >Backend Development >C#.Net Tutorial >Detailed explanation of the role of fgetc function
The function of fgetc function is to read a character from the specified file. It is required that the file must be opened in the reading, reading and writing mode or in the appending mode. The write-only mode cannot be read.
The function of fgetc is to read a character from the specified file. The file must be opened in read or read-write mode.
fgetc is a function in a computer language. It means reading a character from the file pointed to by the file pointer stream. After reading one byte, the cursor position moves back one byte. Format: int fgetc(FILE *stream);.
Usage: The return value of this function is to return a byte read. Returns EOF if the end of the file is reached or a reading error occurs. (Although one byte is returned, the reason why the return value is not unsigned char is that the return value must be able to represent -1 (that is, EOF).)
The general form of function call is, function name (actual parameter list); if a parameterless function is called, the "actual parameter list" does not need to be present, but the parentheses cannot be omitted. If the actual parameter list column contains multiple actual parameters,
separate the parameters with commas. The number of actual and formal parameters should be equal and their types should be consistent. Actual and formal parameters correspond in order, and data is passed one by one. However, it should be noted that if the actual parameter list includes multiple actual parameters, the order in which the actual parameters are evaluated is not determined. Some systems evaluate the actual parameters in order from left to right, and some systems Then order from right to left.
Recommended tutorial: "
c Language TutorialThe above is the detailed content of Detailed explanation of the role of fgetc function. For more information, please follow other related articles on the PHP Chinese website!