View Single Post
  #4  
Old 11-21-2002, 03:22 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Ahhh...

ANSI finalized the C++ standard and decided that iostreams should not have a nocreate flag since it is platform dependent. Therefore the use of it is either non-existent or not dependable.

Heres from gcc.org
there is no ios::nocreate/ios::noreplace in ISO 14882
I have seen ios::nocreate being used for input-streams, most probably because the author thought it would be more correct to specify nocreate "explicitly". So you can simply leave it out for input-streams.

For output streams, "nocreate" is probably the default, unless you specify std::ios::trunc ? To be safe, you can open the file for reading, check if it has been opened, and then decide whether you want to create/replace or not. To my knowledge, even older implementations support app, ate and trunc (except for app ?).
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote