C fscanf()

The fscanf() function works exactly like scanf() function except that it reads informations from the stream specified by stream instead of the stdin

fscanf() Syntax

int fscanf(FILE *stream, const char *format, ...);

The fscanf() function returns number of arguments actually assigned values. This number does not include skipped fields. A returned value of EOF means, a failure occurred before first assignment was made.

fscanf() Example

Following c code reads a string and a float from the stream fp:

char str[80];
float f;
fscanf(fp, "%s%f", str, &f);

C Online Test

« Previous Function Next Function »

Follow/Like Us on Facebook

Subscribe Us on YouTube