Re: ios steram flags vs ios_base stream flags
Denise Kleingeist wrote:
Rune Allnor wrote:
Some of these flags are really useful, ios::nocreate, for instance.
... and not supported by all systems on which C++ shall run
with a full standard C++ library. End of story. The same
applies for "noreplace". For example, I don't think that
POSIX systems can implement "noreplace" in general and
atomically. I'm not sure about "nocreate".
I'm not 100% sure what noreplace means, but wouldn't opening
with the options O_CREAT | O_EXCL do the trick? (And nocreate
is, of course, what you get by default from open.)
For the most part, C++ supports only what maps to fopen modes in
C. But that sort of begs the question as well---C has an append
mode which can't be implemented atomically on some systems, so
why should something like noreplace not be supported, even if it
cannot always be implemented atomically.
Note that there are other flags which might be important in some
applications as well: Posix has various synchronization options,
for example, and in my work (but this is very domaine specific),
I rarely open a file without some of them. (Which means that I
cannot use iostream on the files. But since they aren't really
streams anyway, that doesn't bother me too much.)
--
James Kanze GABI Software
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]