Click to See Complete Forum and Search --> : How to corrupt a file


senegalais
September 11th, 2002, 01:54 PM
Hi,

My application crashed when it tries to open a corrupted file.
I need to be able to reproduce this problem in order to find how to fix it.
Does anyone know how to corrupt a file ?
Or does exactly "corrupted file" means ?

sakthisugumaran
September 12th, 2002, 02:22 AM
What file you want to corrupt .exe or binary or text
file

If .exe means open it any text editor and remove some characters
in that file and save it.

senegalais
September 12th, 2002, 10:34 AM
Originally posted by sakthisugumaran
What file you want to corrupt .exe or binary or text
file

If .exe means open it any text editor and remove some characters
in that file and save it.

Binary file.

stober
September 12th, 2002, 07:09 PM
A corrupt file can mean almost anything -- does it even exist? are the file contents contain what they are supposed to and in the proper format? Maybe another process already has the file open in exclusive mode, so your program cannot open it. If the file exists, and it is not open by another process (or attempting to open it twice in the same process in exclusive mode) then you will have to look at the file's contents and compare them against your program and what it thinks the file format should be. Ask whoever reported this problem to you to send you a copy of the file so that you can evaluate it.

Chriss688Sub
September 12th, 2002, 08:08 PM
I got something like that, when a TEXT file (from a UNIX server) was corrupted during transport. a 500Meg file with 1 or more End Of File (EOF) symbol in the middle (ascii 28). Unix based system dont care about it.

I had to read the file in Binary, forcing to read up to the file size, scan all the characters (in binary) and replace bad caracters by a dot. (Then remove the record).

So inserting binary that are hard to digest for the OS (or read library you are using) is the way to go.

Another example, force the writing on the drive of a file with some bad CRC in a sector. I have no idea how to do that. Most "high level" library will not permit you but a "direct access" type of command will. It is an old copy protection shceme.

Good luck, keep us inform I am curious.

GG

Waldo2k2
September 18th, 2002, 10:46 PM
I'd say try a number of things....a binary file can be opened in a text editor (what comes out is a mystery, but something will show up) try erasing what's there adn saving it. Try removing the file also.
What is the file used for? You say that you need to recreate it, is that because a user of your software encountered the error? Another thought: if it has something to do with installation/uninstallation logging and the like i know what the error corrupted file means (usually at the end of installation, before the log file is written to, but the program has been installed, the computer crashes. In this case the log file would remain blank and upon trying to uninstall it would report a corrupted file). Anyhow just keep us posted. (no pun intended)