I'm using Vc++ 6 by the way.
I have this code to read from a text file:
Expand|Select|Wrap|Line Numbers
- #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!