My objective is to write to a file and read it back. All the reading is done after all the writing.
Code:
// first version
ofstream outFile("file.txt", ios::binary | ios::out | ios::in);
ifstream inFile("file.txt", ios::binary | ios::in);
With codes above, file.txt is not created when I run it.
Code:
// second version
ofstream outFile("studentVer1.txt", ios::binary | ios::out);
ifstream inFile("studentVer1.txt", ios::binary | ios::in);
With these ones, file.txt is created but reading is unsuccessful.
When I do first version and create a blank file.txt, first run will write but fail to read, second run and after will write and read.
So, whatsupp??