I have a text file with the following lines:
1 | Matrix | 1 | Action | 3
2 | X-men 2 | 1 | Action | 2
id | movie name | rental type | genre | stock
I want to read the data from the text file and store 1 into an id variable, Matrix into a movie string etc etc.
Any ideas on how to accomplish this?
I have thought of a few ways to implement this such as by using fgetc and manually checking every char for a '|' but what I would like to do is to use fscanf which would make the whole process much easier. Unfortunately fscanf would not be able to read X-men 2 as a single string.
Thanks in advance.