Article View: comp.os.msdos.programmer
Article #3178Re: Turbo C++ fopen() & fflush()
From: William C. Marsh
Date: Tue, 27 Nov 1990 16:27
Date: Tue, 27 Nov 1990 16:27
26 lines
1557 bytes
1557 bytes
In article <1990Nov26.185230.13800@hellgate.utah.edu> b-davis%cai.utah.edu@cs.utah.edu (Brad Davis) writes:
>In article <1990Nov26.164656.858@hoss.unl.edu> ho@hoss.unl.edu (Tiny Bubbles...) writes:
>>>Problem is, fflush doesn't flush the DOS buffers to disk, so
>>Is this a problem in Turbo C 2.0 also, or is it just an artifact of
>>Turbo C++ 1.0[1]?
>Artifact of MS-DOS from 1.0 to 3.2. As was mentioned, 3.3 has a call
>to do this, but then again, we can all write software that only needs
>to run on 3.3.
An even easier way to do this is to dup() and then close() the filehandle
associated with the stream. This has worked since version 2.0 of MS-DOS.
You do need an open filehandle to do this, however...
i.e.
fflush(stream);
close(dup(fileno(stream)));
Bill
--
Bill Marsh, Naval Ocean Systems Center, San Diego, CA
{arpa,mil}net: bmarsh@cod.nosc.mil
uucp: {ihnp4,akgua,decvax,dcdwest,ucbvax}!sdcsvax!nosc!bmarsh
"If you are not part of the solution, you're part of the problem..."
Technical Details
Message-ID:
<2493@cod.NOSC.MIL>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!nosc!cod!bmarshReferences:
<1778@mts.ucs.UAlberta.CA> <1020@marvin.moncam.co.uk> <1990Nov26.164656.858@hoss.unl.edu> <1990Nov26.185230.13800@hellgate.utah.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!ucsd!nosc!cod!bmarsh From: bmarsh@cod.NOSC.MIL (William C. Marsh) Newsgroups: comp.os.msdos.programmer Subject: Re: Turbo C++ fopen() & fflush() Message-ID: <2493@cod.NOSC.MIL> Date: 27 Nov 90 16:27:17 GMT References: <1778@mts.ucs.UAlberta.CA> <1020@marvin.moncam.co.uk> <1990Nov26.164656.858@hoss.unl.edu> <1990Nov26.185230.13800@hellgate.utah.edu> Reply-To: bmarsh@cod.nosc.mil.UUCP (William C. Marsh) Organization: Naval Ocean Systems Center, San Diego Lines: 26