ifstream stuff
what function do you use with an ifstream object to read a line of text from a file?and does it know to go to the next line if you use it again?
Visit http://members.xoom.com/ivanickgames
Visit http://members.xoom.com/ivanickgames
ifstream infile;
infile.open("blah.dat", ios::in);
char buff[255];
infile >> buff;
it reads the data from a text file, and when it encounters the new line character it advances to the next line.
infile.open("blah.dat", ios::in);
char buff[255];
infile >> buff;
it reads the data from a text file, and when it encounters the new line character it advances to the next line.
hrm.. I''ve never used it myself, but more than likely you could.
I found that >> did all that I needed, so I just stuck with that.
I found that >> did all that I needed, so I just stuck with that.
Aztec,
Actually doing what you did will stop at the first whitespace, so if you want to get the entire line, you should use getline().
-Brian
Actually doing what you did will stop at the first whitespace, so if you want to get the entire line, you should use getline().
-Brian
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement