delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/06/04:16:32

Date: Mon, 6 Aug 2001 09:49:12 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: files not closed after GPF
In-Reply-To: <9kjsnd$ian$1@newsg3.svr.pol.co.uk>
Message-ID: <Pine.SUN.3.91.1010806094852.20688F-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 5 Aug 2001, Matthew Smith wrote:

> If your program was opening the file itself, it could adopt an
> "open,append,close quickly" strategy but redirecting the output makes
> your shell handle this.

Are you saying that because of redirection this cannot work?  Of
course, it can: use `dup' to save the original handle's connection,
close the original handle, then use `dup2' to restore the original
handle.

But it's much better to use `fsync' instead, since it has the same
effect as `close', without actually closing the handle.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019