This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


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

Re: FW: iostream implementaion incomplete



"Shiv Shankar Ramakrishnan" <ShivShanks@MailandNews.com>:
> |You are right that it's non-standard, but libstdc++-2 supported it.
> |Is there a standard-conforming method for opening a file stream that
> |fails if the file doesn't already exist?
>
> You can get a similar affect (in a way) by enabling exceptions so that
> an exception is thrown when a file doesn't exist. So you could then
> immediately catch it and do something else. I don't know whether this
> would suffice in your case though.
> One caveat though - it might even be risky to do this if the code isn't
> exception safe.

Or create the variable, try to open a file, and then use the is_open()
member function for fstreams to test the state.  Takes no arguments and
returns a bool.

Phil


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