On
http://www.cplusplus.com/doc/tutorial/files/ it says:
-----------------------------
Each one of the open() member functions of the classes ofstream, ifstream and fstream has a default mode that is used if the file is opened without a second argument:
class default mode parameter
ofstream ios::out
ifstream ios::in
fstream ios::in | ios::out
-------------------------------
But I don't believe that is the case for fstream. I couldn't get it to work using CL.EXE VC++ -- I had to explicitly set the mode.
This appears to be confirmed by
http://stdcxx.apache.org/doc/stdlibug/30-3.html which states:
----------------------------------
Bidirectional file streams, on the other hand, do not have the flag set implicitly. This is because a bidirectional stream does not have to be in both input and output mode in all cases. You might want to open a bidirectional stream for reading only or writing only. Bidirectional file streams therefore have no implicit input or output mode. You must always set a bidirectional file stream's open mode explicitly.
----------------------------------
Am I correct in concluding that fstream in fact does not have default modes?