Article View: borland.public.cppbuilder.nativeapi
Article #1968Re: FlushFileBuffers on iostream
From: sebor
Date: Fri, 18 May 2007 04:58
Date: Fri, 18 May 2007 04:58
34 lines
2903 bytes
2903 bytes
On May 17, 9:42 am, Darko Miletic <kik...@fibertel.com.ar> wrote: [...] > No. There is no standard way AFAIK to do that. That's correct. For now at least. There is some effort to add support for this in the next C++ standard, along the lines of the Classic Iostream functions fd(), attach(), and detach(). These extensions have already been implemented in the Apache C++ Standard Library. See http://incubator.apache.org/stdcxx/doc/stdlibref/basic-filebuf.html#idx51 > 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 latest Rogue Wave implementation of the C++ Standard Library (as well as Apache stdcxx that was derived from it) is based on the native file I/O (i.e., POSIX read/write or the Windows API), although the library can be configured to use stdio instead as an option. On most operating systems these "native" calls are faster. > > 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:
<1179464295.157028.22250@n59g2000hsh.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!n59g2000hsh.googlegroups.com!not-for-mailReferences:
<4648e0c5$1@newsgroups.borland.com> <1nso43lmgdfu69nqq3t4k82dm91auq1msf@4ax.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,3a931b880c69cb1c X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!n59g2000hsh.googlegroups.com!not-for-mail From: "sebor@roguewave.com" <sebor@roguewave.com> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: FlushFileBuffers on iostream Date: 17 May 2007 21:58:15 -0700 Organization: http://groups.google.com Lines: 36 Message-ID: <1179464295.157028.22250@n59g2000hsh.googlegroups.com> References: <4648e0c5$1@newsgroups.borland.com> <1nso43lmgdfu69nqq3t4k82dm91auq1msf@4ax.com> NNTP-Posting-Host: 71.229.200.170 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1179464295 4046 127.0.0.1 (18 May 2007 04:58:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 18 May 2007 04:58:15 +0000 (UTC) Cc: sebor@roguewave.com In-Reply-To: <1nso43lmgdfu69nqq3t4k82dm91auq1msf@4ax.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.10) Gecko/20070301 Fedora/1.0.8-0.6.2.fc6 pango-text SeaMonkey/1.0.8,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: n59g2000hsh.googlegroups.com; posting-host=71.229.200.170; posting-account=0KOkWw0AAABXJCvm3JWbT0xmtVcyATI-