Deleting a text file after repalcing all char in a random number
-
Hi all, I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file.... It's very urgent..i'll be very grateful if anyone provide the solution.... bye
kamalesh
-
Hi all, I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file.... It's very urgent..i'll be very grateful if anyone provide the solution.... bye
kamalesh
Since the net result is to delete the file, why bother with the character replacement? In any case, just use
DeleteFile()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
Hi all, I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file.... It's very urgent..i'll be very grateful if anyone provide the solution.... bye
kamalesh
kamalesh82 wrote:
I need to open a file using Win 32(MFC API
Is opening the file in WIN32 a problem to you. You can use simple FILE * to read/write to the file.
kamalesh82 wrote:
read each line from it
Use fgets, fgetc etc as per your preference.
kamalesh82 wrote:
after reading all the line i've to replace each char in the file with a random number
Why so? You can read a line and change the character values simultaneously.For this you can create a temporary file in your applications directory and keep on writing that random data in the temp file. When you are done with the reading of the file you can first delete the original file and then rename the temp file.
kamalesh82 wrote:
after that i've to delete that file....
BOOL DeleteFile( LPCTSTR lpFileName );
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Since the net result is to delete the file, why bother with the character replacement? In any case, just use
DeleteFile()
.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
Because the OP is wanting to overwrite the data and thus prevent the file from being undeleted later. IIRC, there was a tool in the 'Norton Tools' set that did just this. They've obviously never seen a computer forensics expert recover data from a hard drive by tweaking the controller board's currents :)
Steve S Developer for hire
-
Hi all, I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file.... It's very urgent..i'll be very grateful if anyone provide the solution.... bye
kamalesh
Are you trying to write your own PGP Wipe?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week Zac
-
Hi all, I need to open a file using Win 32(MFC API).. read each line from it, and after reading all the line i've to replace each char in the file with a random number.. after that i've to delete that file.... It's very urgent..i'll be very grateful if anyone provide the solution.... bye
kamalesh
How are you going to guarantee that the system writes the random bytes over the original bytes on the disk??
-
How are you going to guarantee that the system writes the random bytes over the original bytes on the disk??
i just want "secure deletion"... if i just delete , the data used in the file is very much recoverable, untill the same space of the hard disc is overwritten( as the space is holding the data)... that's y i need to change every char in the file by a random generated numbers
kamalesh
-
i just want "secure deletion"... if i just delete , the data used in the file is very much recoverable, untill the same space of the hard disc is overwritten( as the space is holding the data)... that's y i need to change every char in the file by a random generated numbers
kamalesh
Right I understand but using regular file APIs you have no gaurantee that your random data will be written back to the disk at the same spot. The "old" data could (and most likely WILL) be able to still be seen on the hard drive for an indefinite amount of time. To really pull this off I'm pretty sure you need to work with the disk at a lower level than file APIs. Mark
-
i just want "secure deletion"... if i just delete , the data used in the file is very much recoverable, untill the same space of the hard disc is overwritten( as the space is holding the data)... that's y i need to change every char in the file by a random generated numbers
kamalesh
This may be of interest to you for Windows 2000 and above... How To Use Cipher.exe to Overwrite Deleted Data in Windows[^]