libstdc++-v3 3.4.4: fstream does not create a file on open
Paolo Carlini
pcarlini@suse.de
Tue Jun 5 10:01:00 GMT 2007
Hi Francesco,
>Hi,
>when I try to connect a non existent file to an fstream object calling
>the open member function, the file is not created.
>
This is the behavior mandated by the standard: the default openmode for
an fstream is "in | out", which is the same as "r+" in C. You can change
it, use for example "out", or use an ofstream. Here and elsewhere, since
we are talking about free software, I suggest having a look to the
source code for fstream, there are rather extensive comments...
Paolo.
More information about the Libstdc++
mailing list