The fscanf() function works exactly like scanf() function except that it reads informations from the stream specified by stream instead of the stdin
#include<stdio.h> 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.
Following c code reads a string and a float from the stream fp:
char str; float f; fscanf(fp, "%s%f", str, &f);
© Copyright 2021. All Rights Reserved.