So I'm trying to count the number of lines in a text file. I think I got it working, but it seems I can't do further correct processing on the text file, maybe because getline extracts the data? The operations I want to perform include inputting values read from the file into an array (This works correctly if I comment out the code for counting the lines, but the output is wrong if I include the code).
string fileName;
cin >> fileName;
ifstream inData;
inData.open( fileName.c_str() );
if ( !inData )
return 0;
size = 0;
string line;
while ( !inData.eof() )
{
getline(inData, line);
size++;
}