rettix
2008-03-12 20:17:58 UTC
What i would like to do is have 250 nodes of one type of linked list. So, my question is how do I read in just one line at a time while still capturing each set of numbers from each line? So I can reset my main linked list back to the root node when I reach the end of the line. For example, I want to have 250 nodes for the main list, and then have 4000 nodes in another linked list stemming from each of those 250 nodes.
This is what I am using to read from the file:
while( fscanf( input, "%lf", &data) == 1){
//do stuff
}
And of course as you can imagine it doesn't recognize line breaks. It just continues to create new nodes until the end of the file. Hope this makes sense.