There are a couple of things to consider:
Lets assume you have two numbers on each line followed by text you don't care about.
while(inFile >> rows >> columns)
{
// Successfully read rows and columns
// Now remove the extra stuff on the line you do not want.
inFile.ignore( std::numeric_limits<std::streamsize>::max(), '\n' );
}
Also note if the only thing separating the integer values is "white space" then you don't even need to use the ignore() line.
The above while() works because: The operator >> returns a stream object (reference). Because the stream object is being used in a boolean context the compiler will try and convert it into a bool and the stream object has a cast operator that does that conversion (by calling good() on the stream).
The important thing to note is NOT to use the line
while(inFile.eof())
If you do use this then you fall into the trap of the last line problem. If you have read all the data eof() is still false (as it is not true until you try and read past EOF). So there is no data left in the file but you still enter the loop body. In your code the getline() is then executed and fails (no more data), EOF is now set. What the rest of the loop does will depend on how and where inLine is defined.
You can use this test as above. But you must also be willing to test the stream is OK after you have used it.
while(inFile.eof()) // Should probably test good()
{
getLine(inFile,inputline);
if(inFile.eof()) // should probably test good()
{
break;
}
}