Hi there,
I'm undergoing my first year of study in C programming. I was wondering if anybody could point me in the right direction for some homework I have.
I've been given a text file, which contains data that needs to be sorted into nodes and then arranged into a linked list.
So, say the data is in this format:
age: 32
day: Thursday
country: Australia
about: My favourite food is spaghetti
and I really like cats
Love Anna
age: 67
day: Monday
country: New Zealand
.. and so on.
At the moment, entire text file is opened and read as a string.
I need to read '32' and assign it to node->age, and so on for all the other values. I've written the structure for creating nodes etc. What I'm completely stumped on is how I tell the program what text to store where. In other words, how do I tell it to store '32', 'Thursday' and 'Australia'
Do I have to traverse trough the txt file until the word 'age:' is found? And if so, how do I then tell the program when to finish reading the text and move on to the next set of data for the next node?
Thanks in advance