I have a situation in the code where there is a huge function that analyzes the records in turn, checks and writes to another file.
If there are errors in the file, it calls another function that rejects the record and writes the reason for the rejection.
A memory leak in the program crashes with SIGSEGV. One solution of the type "Restart" the file from which it crashed was to write the last processed record to a simple file.
To achieve this, the current record number in the processing cycle must be written to the file. How can I make sure the data is overwritten in a file in a loop?
Does fseek use first position / rewind in the loop, impairing performance?
The number of records can be many, from time to time (up to 500K).
Thanks.
EDIT: A memory leak has already been fixed. The restart decision was proposed as an additional security measure and means to provide a restart mechanism together with the SKIP n records solution. Sorry for not mentioning this before.
source
share