Original Post
I am slightly confused on reading a file. I know how to initialize and open a file for reading but I''m a little bit fuzzy on the actual reading part. Here''s an example code I got out of a book:
I think Statement A tells the program to read the int on the first line on the file being read, and once finished, go to next line. Please explain this to me.
I also have another question:
How could I (if the line number was known) go to a specific line in the file being read and print the infomation after it for a certain amount of lines, with the information being read in a char format.
Any tips are appreciated!
RyanC (C++ Beginner)
---------------------------
Games are only as good as you make them...
//This is where the statements that initialize go
do
{
infile>>x; //Statement A
cout<<x<<end1; //Statement B
}while(!infile.eof());
|