Alright I don't understand how I would go about reading in from a file to store those values in multiple structs. I've been trying to read tutorials on this for awhile to no avail. Could someone shed some light on this for me in lame mans terms would be helpful haha. This is what I'm trying to do
Not sure how to go about it at all, reading material, examples, anything would be appreciated.Code:#include <stdio.h>
typedef struct {
int number;
int rating;
char compName;
char compType;
} review;
int main()
{
int i;
char buffer[1000];
FILE *fp; //setting file pointer to fp and reading the file
fp=fopen("review.txt", "r");
while (fgets(buffer,1000,fp)!= NULL){ //storing the file in buffer
puts(buffer);
}
//Now I want to store the multiple values that are in the text value into the multiple elements of the structure, theres going to be 4 values for number etc, they are formatted line by line in the file
}