Is there a simple way to use fscanf
or fgets
in C to simulate this behaviour:
Suppose I have a file which is structured like this:
Integer \t String \t double
Integer \s String \s double
Is there a way I can apply fscanf in this situation to input it in a struct
?
I have tried using multiple regular expressions in my fscanf and I have failed to accomplish what I need to do.
I would want the struct to look like this:
struct foo {
int first;
char * second;
double third;
};
and then fscanf
in those 3 elements.