Hi! I am not a C++ expert, please help me..im getting a little confused.
I'm using Vc++ 6 by the way.
I have this code to read from a text file:
my prob is how to parse "line" so that I can store the values that i needed.
For example, if test.txt has the following information,
35 6
I need to store 35 to an int variable, and 6 to another int variable.
or, if I got 344:5
just the same as above, but this time, separate by a colon, not a whitespace..
please help me out..im really lost :(
Thank you very much!
I'm using Vc++ 6 by the way.
I have this code to read from a text file:
Code:
#include <fstream.h>
char line[100];
void main()
{
ifstream fin("test.txt");
while( fin.getline(line, 100) )
{
cout << "read line: " << line << endl;
}
}
For example, if test.txt has the following information,
35 6
I need to store 35 to an int variable, and 6 to another int variable.
or, if I got 344:5
just the same as above, but this time, separate by a colon, not a whitespace..
please help me out..im really lost :(
Thank you very much!
Comment