Topic: Nocreate and sh_none in <iostream> (not <iostream.h>)


Author: "Bill Wade" <bill.wade@stoner.com>
Date: 1999/09/14
Raw View
Rami Jaschek wrote in message <37DA16D0.A018D13A@softov.co.il>...
>Hi,
>
>My problem is as follows : I'm moving from <iostream.h> to <iostream>. I
>was using :
>'filebuf::sh_none' to gain exclusive control of a file and
>'ios::nocreate' to fail whenever the
>file was not already there.
>
>I can't seem to find anything like it in the new header files. Can you
>tell me how to get the
>same effect in another way ? same way ?

Nothing like sh_none is in the standard.  To get the effect you'll need to
write or find something beyond the standard.

The following combinations of ios flags, when used with filebuf, should
(according to the standard) fail if the file doesn't already exist:
(in),(in|out),(binary|in),(binary|in|out).  They correspond to fopen() flags
"r", "r+", "rb" and "r+b".

HTH
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]





Author: Rami Jaschek <jrami@softov.co.il>
Date: 1999/09/12
Raw View
Hi,

My problem is as follows : I'm moving from <iostream.h> to <iostream>. I
was using :
'filebuf::sh_none' to gain exclusive control of a file and
'ios::nocreate' to fail whenever the
file was not already there.

I can't seem to find anything like it in the new header files. Can you
tell me how to get the
same effect in another way ? same way ?

Any help would be greately appreciated.

Rami

jrami@softov.co.il
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]