|
-
June 24th, 2008, 05:40 AM
#1
how to delete contents from a file?
I have created a binary file usinf CFile. Now, i want to delete some of the contents of this file. How to do this?
-
June 24th, 2008, 05:56 AM
#2
Re: how to delete contents from a file?
Create a new file and copy everything you do not want to delete ... I would propose.
regards
HoM
-
June 24th, 2008, 07:25 AM
#3
Re: how to delete contents from a file?
You cannot just delete part of a file unless the part to delete is at the end of the file. In that case you can just schrink the filesize to delete that part.
Otherwise, you need to read everything to memory and only write what you want back to a file or copy the relevant parts to a temporary file first, then delete the original file and move the temporary file to the correct filename.
-
June 24th, 2008, 07:48 AM
#4
Re: how to delete contents from a file?
You can use CFile::SetLength to reduce the file size.
Nobody cares how it works as long as it works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|