There is one file ofstream fout("fout.txt"); I transfer it to 2 functions, in the first function it is necessary to make an entry, and in the second function it is necessary to read it, that is, it turns out to be first as ofstream, then ifstream. How can you do it right? To transfer it as ifstream?
|
1 answer
If you need to write and read, just use fstream (without o- and without i-), open in read and write mode at the same time. For example:
fstream file("Notebook.dat", ios::binary | ios::in | ios::out); - when changing to fstream, ifstream methods disappear? for example get - Arkady
- it turns out some methods are saved, everything works thanks! - Arkady
|