Mail Archives: djgpp/2001/08/05/18:30:27
In article <9kjsnd$ian$1 AT newsg3 DOT svr DOT pol DOT co DOT uk>,
matt AT the-good-stuff DOT freeserve DOT co DOT uk says...
>
>
>>
>> Is it a bug ?
>
>I think you are doing about as well as can be expected, only losing
>one line line that.
>crashing with files open can actually wipe your whole file system if
>you are exceptionally unlucky.
>
>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.
>
>You could try outputting a few line feeds after critical information
>to flush the shell's buffer to disk.
Better yet flush the file to disk after every write. If you are using buffered
file io (fopen), use fflush( FILE *foo );, for unbuffered io (open) use
_dos_commit( int foo );. The flushing will be done before the crash and the
info should be in the file, baring other problems.
- Raw text -