Problem: Truncated output files after crash





Hi Guys,

certain parts of my program (terraform) frequently write output files.
I noticed that when it crashes any output files that it has written during
the current run (doesn't seem to matter how long ago the actual file
was written) are truncated so they miss the last few bytes.

In my code I write the data and then do a
     fflush (file_ptr);
     fclose (file_ptr);

however adding the fflush() call doesn't change a thing; files are
still truncated after a crash. If the program exits properly (ie: without
a core dump), the files are written to disk as they should; otherwise
they are truncated.

Does anybody have a suggestion as to what I'm doing wrong (other
than the obvious one that I should fix my core dumps).

Thanks
--> R




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]