Re: std::ofstreams and HANDLES in VC7.1

From: Russell Hind (no-one_at_no-where.com)
Date: 07/23/04


Date: Fri, 23 Jul 2004 16:27:32 +0100

Kostka, Volkmar wrote:

> Hello,
>
> "Russell Hind" wrote ...
>
>>I know it would be a non-standard extension, but is it possible to
>>construct an ofstream with an already opened file handle?
>>
>>I need to use the CREATE_NEW flag to force a failure if the file exists
>>so must use CreateFile for this, but want to access the file as a
>>std::ostream?
>
>
> What's about using the openmode "ios::in | ios::out | ios::app". This should
> open the file only if the file already exists.
>

I want to create the file only if it *doesn't* exist, hence CREATE_NEW
which fails if the file exists.

Thanks

Russell



Relevant Pages

  • Re: std::ofstreams and HANDLES in VC7.1
    ... "Russell Hind" wrote ... ... > I know it would be a non-standard extension, ... > construct an ofstream with an already opened file handle? ...
    (microsoft.public.vc.stl)
  • Re: std::ofstreams and HANDLES in VC7.1
    ... >construct an ofstream with an already opened file handle? ... >I need to use the CREATE_NEW flag to force a failure if the file exists ...
    (microsoft.public.vc.stl)
  • std::ofstreams and HANDLES in VC7.1
    ... I know it would be a non-standard extension, ... construct an ofstream with an already opened file handle? ... Russell ...
    (microsoft.public.vc.stl)