Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - What will be returned by reading plastic data from an empty file with fscanf function? Is it 0?
What will be returned by reading plastic data from an empty file with fscanf function? Is it 0?
The usage of fscanf is: int fscanf (file * stream, char * format, [argument...]);

In other words, an integer value will be returned in the end, which is certain, but when the data can be read normally, fscanf returns the number of read data, otherwise it returns EOF. EOF is displayed as-1 in a plastic way.

For example:

n = fscanf(f," %d ",I);

Here f refers to a file with no content, and I and n are two integer variables. At this time, I has not been reassigned because the data cannot be read in. If the original I has a value, the value remains the same. If it is not assigned, it will be an arbitrary number. And n is the EOF at this time, that is,-1.