A
A
Anton Fedoryan2016-01-27 14:53:35
C++ / C#
Anton Fedoryan, 2016-01-27 14:53:35

How to remove structures from a file?

Using the Marshal class, I wrote several structures to a file. How to read them from a file by offset, in principle, is also clear.
Prompt any optimum variant of removal of structure from a file. All that came to mind and was found on the Internet: overwrite the structures in a file, skipping the one that needs to be deleted. But a costly way, because. records can be about a million.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peter, 2016-01-27
@petermzg

Options.
For a simple deletion, you have options:
1. Leave space/variable in the structure for the flag - deleted. And just rewrite it.
2. Shift all data in the file, starting from the position behind the structure, to the place where the deleted structure starts. An incredible amount of action with a gigantic file and structure at the beginning of the file.
The remaining options are special cases of these 2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question