I'm trying to get my program to read from a text file, but the only way I'm able to get it accurate at the moment is to set the first loop to the number of lines of data that I have. I'm looking for a way to set it so that I can have it read until the end of the file. Using the !(in.eof()) thing gives me an extra line at the end. Any help would be appreciated, sorry if I'm not overly clear.

using namespace std;
int main()
int a,b;
ifstream in("d:\\testin.txt");
ofstream out("d:\\testout.txt");

for(int l=1; l<=14; l++)

	for(int c=1; c<=2; c++)
out<<l<<" "<<b<<endl;



>>Using the !(in.eof()) thing gives me an extra line at the end
Yup -- that's why we never use eof() like that. Here is one way to do that loop

while( in>>a )
   // your code here

Thanks for the replies, they help!