I use a text file to store data records. data is saved in the following format.
Antony | 9876543210
Azar | 9753186420
Branda | 1234567890
David | 1357924680
John | 6767676767
Thousands of records are stored in this file. I want to delete a specific entry, for example "David | 1357924680". I am using C, how to efficiently delete a specific entry? I am currently using a temporary file to copy entries to this temporary file, omitting the entry I want to delete. and after copying to the temp file, I copy the contents of the temporary file to the source file, trimming the entire contents of the source file. I do not think that I am doing this effectively. Help me.
source
share