This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]