Mail Archives: djgpp/2001/08/06/04:16:32
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 -