X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: fstream and fflush Date: 22 Oct 2004 18:46:09 GMT Lines: 22 Message-ID: <2tt2rhF22u71pU1@uni-berlin.de> References: <2tqpgmF245sdvU4 AT uni-berlin DOT de> X-Trace: news.uni-berlin.de y1zsOWsnigEd1IlPoYxD3wSGdqoIryyuZHIGWS64epDpdc1neBYqLErOOC X-Orig-Path: not-for-mail To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Jason Mills wrote: > Hans-Bernhard Broeker wrote: [...] > for example. > 2. Perhaps unwisely, I was using stat() to query the file size > periodically in order to rotate the log file based on file size. Well, fstat() would probably have been wiser in this case. But the main problem is that your program, as you write elsewhere, assumes the operating to be Unix, whereas you're actually on DOS. DJGPP does try rather hard to make DOS look and behave very much like Unix, but there is a limit to that, and stat() and simultaneous access to the same file by two independent system calls is about where that limit is. In actuality, fsync() would really have been recommendable on Linux, too, for this task --- that you didn't seem to need it was more by luck than by design. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.