In the last few programs, we have studied how files could be opened for reading and writing using construc-
tors. Now the second approach can be used with open() function. The function open() is used to open
a file. The open() function uses the stream object. The open() function has two arguments. First is file
name and second is the mode. The mode specifies the purpose of opening a file i.e., read, write, append etc.
The details are discussed in Section 20.5. In the following examples, default mode is considered. The default
values for ifstream is (ios::in), reading only ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.