public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* ios:nocreate
@ 2002-09-27 10:30 Yu-Lun Chen
  2002-09-27 12:09 ` ios:nocreate John Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: Yu-Lun Chen @ 2002-09-27 10:30 UTC (permalink / raw)
  To: gcc-help


Hi,

While upgrading from g++ 2.95.3 to 3.2, I encounter the following
problem. For some reason, the old ios:nocreate mode for the open()
method in ifstream is no longer supported. Is there a work around for
this? Thanks in advance!

Yu-Lun Chen  <---------------------------->  yu-lun@marc.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ios:nocreate
  2002-09-27 10:30 ios:nocreate Yu-Lun Chen
@ 2002-09-27 12:09 ` John Love-Jensen
  2002-09-27 12:33   ` ios:nocreate John Love-Jensen
  0 siblings, 1 reply; 3+ messages in thread
From: John Love-Jensen @ 2002-09-27 12:09 UTC (permalink / raw)
  To: yu-lun, gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ios:nocreate
  2002-09-27 12:09 ` ios:nocreate John Love-Jensen
@ 2002-09-27 12:33   ` John Love-Jensen
  0 siblings, 0 replies; 3+ messages in thread
From: John Love-Jensen @ 2002-09-27 12:33 UTC (permalink / raw)
  To: John Love-Jensen, yu-lun, gcc-help

Ooops,
c/fs/foo/

Or qv:
http://www.devx.com/free/tips/tipview.asp?content_id=3338

--Eljay
(That's what happens when you have a little at work celebration.  *hic*)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-27 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-27 10:30 ios:nocreate Yu-Lun Chen
2002-09-27 12:09 ` ios:nocreate John Love-Jensen
2002-09-27 12:33   ` ios:nocreate John Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).