Execution of this second program yields a blank line, despite the fact that I opened the same file as the one in the previous program, which has student information in it.
Okay, I implemented a check in the second program, but no error message comes up - I just get a blank line.
And what do you mean by "using the same working directory"? The code that I posted has all the "include" lines that are in the program - I've shown everything.
This is my first time ever using files in my life, so I'm sure I'm missing something basic.
if (!ifh.is_open())
{
cout << "file is not open" << endl;
return 1;
}
I get one of two results. If the file is not opened, the "not open" message appears.
Otherwise I get the first word of the first line displayed, "Steven".
My original guess was that the file "Student.dat" was created in one directory (or folder), but the second program was looking for it in a different directory.