Take a look at the standard getline() function and string streams in
C++ book, I guess you will find the answer, If I got that right
getline reads whole line excluding the newline character
and in brief you can extract the necessary information with string
streams I guess
Regards,
Tasha Darke wrote:
Hi,
I'm having a problem finding the answer to a problem I'm having. I'm
trying to read data for a neural network from a text file where the
inputs are on one line, and the expected output the next. I can read
the inputs no problem, but where I expect the program to move to the
next line it instead continues to read "white space" on the same line.
The text file looks something like this
-1 -1 0 .......... -7 0
0.80000
I see -7 and 0 going into the training data array, followed by a load
of 0s, and not 0.8. I'm using fscanf to grab the numbers out (I'll
admit to not being very proficient with C++, and yes this is for Uni
coursework), since all the documentation I've read indicates that
fscanf will jump whitespace (and I therefore assumed lines).
I'm evidently missing something major here, so any assistance/links
would be gratefully recieved.
If you need to see the code in progress, I will happily post.
Tasha