Storing scanf data in separate lines?
Hello guys, I have a question:
Right now I need to basically build a function that reads from a file which has multiple sets of data stored as multiple lines. I've built the scanf to record all the data of each line and store them in their respective variables (with an array for each line), but my question is how do I call an output of each line based on one of the variables?
Here is an idea of my code:
Code:
fo = fopen("test.txt","r");
while(!feof(fp)){
fscanf(fp, "%d,%c,%d,%d\n", "e[i], &room[i], &length[i], &width[i]);
i++
}
fclose
That records each value on each line and stores them in the arrays.
So my question is, how would I call for a specific line, say, based on the value of quote? I have a menu function built as well, and one of the selections asks you to enter the quote number, so I need to enter a quote number here, scan the file, and display the data for that line.
Any help would be much appreciated, thanks so much.