Hi there,
Say I have the following while loop, that loops on the condition that a lne (a string) is received from a file:
while ( getline( inData2, line ) ) // Increment rows till none left
{
if ( !line )
{
cout << "No data entered. Please enter data. Program terminated." << endl;
exit(0);
}
....
}
1) How do I check whether there is no line (string) received? Writing !line doesn't seem to work.
2) Is using exit(0) the best way to termine the program of no lne is entered?