Re: iostreams equivalent to C's fopen "r+"
From: Dave O'Hearn (daveoh77_at_pobox.com)
Date: 11/18/03
- Next message: Edward Diener: "Re: Problems with enums across a dll interface?"
- Previous message: jeffc: "Re: Isn't 'vector' a misnomer?"
- In reply to: Chuck McDevitt: "Re: iostreams equivalent to C's fopen "r+""
- Next in thread: Rick Noelle: "Re: iostreams equivalent to C's fopen "r+""
- Reply: Rick Noelle: "Re: iostreams equivalent to C's fopen "r+""
- Reply: Mike Wahler: "Re: iostreams equivalent to C's fopen "r+""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Nov 2003 13:25:10 -0800
"Chuck McDevitt" <Chuck_McDevitt@c-o-m-c-a-s-t.net> wrote:
> You are obviously on Windows. As far as I know, it's implementation
> defined if the file gets created or not.
> In the Windows implementation it does, on most Unix systems it does not.
>
> Windows has a ios::_Nocreate you can set.
I have two systems, a Red Hat 6.2 with gcc 2.95.3, and a Red Hat 9
with gcc 3.2.2. The ancient system has an ios::nocreate, and it's
definately creating the files unless I put ios::nocreate in there. I
don't know what the newer system does by default, but it has no
ios::nocreate, so I can't put that in my code without conditional
compilation, or it won't compile on Red Hat 9 at all.
I think I have to use the hack I found online, where you open for 'in'
mode first, then if it succeeds, reopen for in|out mode. It's odd that
'nocreate' isn't standard, since it's easy enough for a library to
fake even if the OS doesn't support it... and if the library doesn't
fake it, all the user code has to fake it instead. But that didn't
happen, so I will just have to fake it myself, oh well. Thanks.
-- Dave O'Hearn
- Next message: Edward Diener: "Re: Problems with enums across a dll interface?"
- Previous message: jeffc: "Re: Isn't 'vector' a misnomer?"
- In reply to: Chuck McDevitt: "Re: iostreams equivalent to C's fopen "r+""
- Next in thread: Rick Noelle: "Re: iostreams equivalent to C's fopen "r+""
- Reply: Rick Noelle: "Re: iostreams equivalent to C's fopen "r+""
- Reply: Mike Wahler: "Re: iostreams equivalent to C's fopen "r+""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|