Section 4 - Further Topics on Streams
9B.4.1 Other String Constructs
There are some advanced aspects of file I/O that you can look up in a reference -- we won't go further into them here. For instance, when you create an ofstream object, you will erase the named file and overwrite it. If you wanted to keep the file and append to it, instead, you would use this constructor form:
ofstream theConnection("myOutputFile", ios::app);
The latter parameter can be a combination of ios::in, ios::out, ios::binary, etc., as in
ofstream theConnection("myOutputFile", ios::app | ios::in | ios::binary);
which means you are or-ing the flags together to enable binary input and output using append mode on your file. As I said, for all the juice on this, consult a reference on C++.
We will stop here this week. We are approaching the end of the course, and I want you to review, digest and reflect on what you've been learning. Next week we will wrap things up and say farewell for a while.
