Conducting ios::out & ios::in meanswhile will lead to something wrong.
When I declcared a variable of fstream and opened a file within my work directory with “ios::in | ios::out”, something wrong occured.
- Just only a sort of operation(i/o) can be done normally, and another one can not be done in a normal way.
- The sort operation can be done deponding on the calling order of reading / writing. If reading is run before writing, the reading gonna be successul, but the writting gonna be wrong.
When I separately declare an ifstream and an ofstream variable, and then, the issue was solved.
- Things go allright.
Here is the source code leading something wrong.
enter image description here
New contributor
Noah Miller is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.