Thread: SecureOverwrite
View Single Post
Old May 18th, 2006, 4:41 PM   #5
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Ok, I re-wrote some of it, but I have a few things I do not understand, so maybe yall can help me with that. By the way, thank yall for the suggestions and comments on the program.

@The Dark: I found a function that tells me the size of the file in bytes. For every byte that is in the file, I write one 0 so that it is overwritten. (I think one char is one byte) For example:
Quote:
Originally Posted by Original File
My name is Bob the Tomato.
turns into
Quote:
Originally Posted by Modified File
0000000000000000000000000
. I was wondering, if I use ios::/out (/ added because of stupid smiley) as an ofstream flag, is this the same as calling ios::trunc? And why is it a bad thing to truncate the file if it still exists? I thought it would be safe as long as the file still exists on the hard drive, obviously it would be un-safe if the file had been deleted somehow.

@nnxion: I took out the #included .cpp file and defined it in my source. I was trying to save space when I posted the source on the forums, not a big deal though. The KillProcess() code accepts a filename, as far as I was aware. Perhaps I need to re-read that whole function and see if I missed something.

@IR: I had that in the loop because I originally was overwriting the file over and over again, but now it just overwrites it once.

Thanks again for helping me out with this.
My updated code is attached.
Attached Files
File Type: zip SecureOverwrite.zip (2.4 KB, 2 views)
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote