The best way to delete a record from a file?
Lets say I have a file name "cars.bin".
Each record in the file is a struct (made from int, char , int).
Lets say I have 10000 records,
struct 1, struct 2, struct 3, struct ....., struct 10000.
Now, If I want to delete record #400, how should I do it??
The only thing I could think of is to:
1. Create a new file
2. Copy all the records from old file to new file (except of the #400)
3. Delete old file
4. Rename new file to old file name.
This seem like a slow poor solution, is there any other way to do it?