Corrupt files

Technical discussions
Post Reply
Ibi
Posts: 19
Joined: Mon Jul 29, 2013 12:44 am

Corrupt files

Post by Ibi »

Hi
Is it possible to check if a graphics file (glm etc) is corrupted before trying to open it. For some strange reasons some of my graphics files get corrupted and when I tried to open them my program crushes. Any advice will be appreciated.
Ibi

nickz
Site Admin
Posts: 236
Joined: Fri Jul 26, 2013 3:58 am

Re: Corrupt files

Post by nickz »

Ibi,
Files get corrupt when something bad happened to PC or you have pulled out a USB stick without stopping it. Windows tries to close files nicely even if there was an exception.

You can do some quick checks. I never had to do it so far. One which comes to mind is to check file size. Corrupt files often have zero size. I just have checked: An empty .glm file has 264 bytes size

There is some header information in .glm which is same in all .glm. I need to check. It is probably at least 100 bytes. So you can create a utility to check for that.

A .glm can get corrupt at any place though. So the most reliable way is to load it in a KC sample. It is pretty easy to create a utility, which loads and unloads all .glm in a folder with catching exceptions

Nick

Ibi
Posts: 19
Joined: Mon Jul 29, 2013 12:44 am

Re: Corrupt files

Post by Ibi »

Thank you Nick for your help
I have another question, not related to the problem (or may be related?).
I will post it separately
Ibi

Post Reply