I think i might need to use a boolean bValue = false for my while condition:
char cArray[ 100 ] = "";
ifstream object;
cout << "Enter full path name: ";
cin.getline( cArray, 100 );
if ( !object ) return -1 // Path is not valid? This statement executes why?
ifstream object.open( cArray, 100 );
// read the contents of a text file until we hit eof.
while ( !object.eof() )
{
// parse the file here
}
Why can i not enter the full path name of the text file?
It might be because of the eof. Is their syntax for a boolean statement that can emulate eof?
Can i have:
while ( !object == true )
{
// parase contents of file
}
See Question&Answers more detail:os