Advertisement

File I/O question from Resource Handler article

Started by March 02, 2000 09:39 PM
0 comments, last by Nexis 25 years ago
Ok, I was looking at that resource handler article and I''ve got a question on deleting lumps in the file. How exactly do I do that besides creating a new file and deleting the old one? Or is that the only way? I didn''t see that part of the code explained in the article (although I might have missed it). I''ve been using fread and fwrite to do this and I can''t figure out how to delete a block that has already been written (not overwriting it with new data, but just like deleting a block in the middle of a file).
I haven''t read that article myself so this could be totally wrong.
One thing you can do is set the index of the "to-be-deleted" lumps to 0. Then you can create a temporary resource file and copy all lumps with an index > 0 to the temporary file. When you''re done erase the old file and rename the new one. That''s one way to do it, although there are other more efficient ways.

Joe Woynillowicz
Isolation Studios

This topic is closed to new replies.

Advertisement