Article View: borland.public.cppbuilder.nativeapi
Article #1966Re: FlushFileBuffers on iostream
From: Darko Miletic
Date: Thu, 17 May 2007 15:42
Date: Thu, 17 May 2007 15:42
25 lines
1986 bytes
1986 bytes
On 14 May 2007 15:20:53 -0700, "Old Wolf" <oldwolf@inspire.net.nz> wrote: > >Is it possible to obtain a Windows HANDLE for a file >that I've opened as a C++ fstream, so that I can call >FlushFileBuffers on it? No. There is no standard way AFAIK to do that. Standard says that all I/O functions (opening, closing, reading and writing) are forwarded to the std::basic_filebuf class. Common implementation of this class uses C file streams for all operations. That is the case with Dinkumware, RW and stlport. The only thing you can do is to implement your custom version of file stream which would generaly mean you will need to create your version of basic_filebuf class and new version of fstream class that uses that new version of basic_filebuf for I/O. In that implementation you will have to use CreateFile/CloseHandle and other respective windows API functions. As a starting point take a look at this article: http://incubator.apache.org/stdcxx/doc/stdlibug/39-2.html
Technical Details
Message-ID:
<1nso43lmgdfu69nqq3t4k82dm91auq1msf@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4648e0c5$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3a931b880c69cb1c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: Darko Miletic <kiklop@fibertel.com.ar> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: FlushFileBuffers on iostream Date: Thu, 17 May 2007 12:42:17 -0300 Message-ID: <1nso43lmgdfu69nqq3t4k82dm91auq1msf@4ax.com> References: <4648e0c5$1@newsgroups.borland.com> X-Newsreader: Forte Agent 3.3/32.846 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000741-0, 17/05/2007), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 200.89.185.153 X-Trace: newsgroups.borland.com 1179416480 200.89.185.153 (17 May 2007 08:41:20 -0700) Lines: 26 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail