February 13th, 2006, 03:38 PM
Delete block from file
Hi to all,
I have a simple problem (question) about C++. I use Windows API functions ReadFile and Write file to "hide" one file in another and then to extract this file. My question is how can I delete the "hidden" file which is exactly a block in the other file? I'm using WindowsXP and Borland C++ Builder 6.0 if this can help.
P.S. If somebody want I can post the source if the program.
February 13th, 2006, 04:01 PM
Read block.. If block == your inserted data skip next step.. Write block.. repeat until end-of-file.
Experience is something you don't get until just after you need it.
February 13th, 2006, 06:37 PM
I didn't understand your solution. Could you explain ...
February 15th, 2006, 07:56 PM
anybody there ... anybody can help me ?
February 16th, 2006, 12:14 AM
Read up until the block you want to delete, then skip that block, then read and write till EOF, then truncate the file to the new size. Not sure how to do that in windows, so I hope you are.
May 29th, 2006, 05:54 PM
How is the one file 'hidden' in the other? You could, for example, maybe like
Read up until the hidden file. Remember where that point in the file is. Read the hidden file into a buffer. Then read the rest of the file into another buffer. Then seek back to the point where the hidden file was, write the rest of the file buffer to that place, and set the EOF after it.
Edit: If you just don't know the API's and didn't need conceptual stuff I can list those
May 30th, 2006, 05:40 AM
Tonto, Just a heads up but if you notice the date on this thread is flashing which prolly means the user got his/her answer by now. Please take a look at the AO FAQ and enjoy your stay here!
May 31st, 2006, 12:16 AM
Sorry about that. Didn't realize that a lot of these threads are pretty old.
May 31st, 2006, 12:18 AM
Its no prob I was just giving you the heads up so you dont start your time off here in the red by getting negged when you dont have too.