#169236 - DiscoStew - Wed Jun 24, 2009 9:23 pm
This is an odd problem for me, because it's a problem that "sometimes" happens. It's not random, as I can duplicate the error by reading each file in a particular order. Changing the order may bring up the error earlier or later, and the file the error comes up with in one order doesn't occur in another order, as some other file brings it up instead.
Anyways, this came up when working on a decompression method for my project. I haven't had any problems with the algorithm when it ran on the PC, but on the DS (hardware and emulator), the problem occurs "sometimes". I spent weeks on trying to fix it, thinking it was my algorithm......until just today when I thought about making duplicate copies of each file, reading them alongside the originals (ignoring my decompression algorithm altogether), and comparing the value read from one with the other.
The result? I think I'm reading garbage because the value between the 2 doesn't match, which is odd, because the garbage is read midway through the files, not at the beginning. Has anyone else been reading "garbage" from files? The functions I use for this are fopen, fclose, and fread (which will only read 1 byte at a time).
_________________
DS - It's all about DiscoStew
Anyways, this came up when working on a decompression method for my project. I haven't had any problems with the algorithm when it ran on the PC, but on the DS (hardware and emulator), the problem occurs "sometimes". I spent weeks on trying to fix it, thinking it was my algorithm......until just today when I thought about making duplicate copies of each file, reading them alongside the originals (ignoring my decompression algorithm altogether), and comparing the value read from one with the other.
The result? I think I'm reading garbage because the value between the 2 doesn't match, which is odd, because the garbage is read midway through the files, not at the beginning. Has anyone else been reading "garbage" from files? The functions I use for this are fopen, fclose, and fread (which will only read 1 byte at a time).
_________________
DS - It's all about DiscoStew