This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ios:nocreate
- From: John Love-Jensen <eljay at adobe dot com>
- To: <yu-lun at marc dot com>, <gcc-help at gcc dot gnu dot org>
- Date: Fri, 27 Sep 2002 14:06:27 -0500
- Subject: Re: ios:nocreate
Hi Yu-Lun,
The ios::nocreate setting did not make it into the ISO 14882:1998 C++
standard. Too platform specific.
You can simulate that behavior with:
fstream foo("foo.txt", ios_base::in);
if(!fs) {
// File does not exist.
// Do not create one.
}
else {
foo.close();
foo.open("foo.txt", ios_base::out);
}
Note: the ios::xxxxx settings are from the defunct <fstream.h> header file.
While the ios_base::xxxxx are from the <fstream> (notice, no .h suffix)
header file, within the std namespace.
--Eljay