[AD] Reading an allegro packed file directly from a datafile returns incorrect values |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Version of Allegro: 4.2.0. Using PACKFILE/pack_fopen/pack_iputl I am writing some data to a file, packed (mode "wp"). I am then putting this file into a datafile with the grabber tool, as binary data. When I try to read this file from the datafile directly, however, the results I get back during reads are complete garbage. I'm reading in the file using PACKFILE/pack_fopen/pack_igetl with a mode of "rp" using the magical notation (e.g., "datafile.dat#object").
I have noticed that if I generate a file without the pack mode this all works perfectly fine. Either this is a bug, or reading files (that are packed) directly from a datafile is invalid. I'm not sure which. For the record, the datafile is using no compression. I have attached a set of test programs you can use to verify the issue.
fileMaker.c will simply generate a file named "file" that is written with mode "wp" and should contain the value "123" written using pack_iputl. fileReader.c will open the packed file in mode "rp" and print the contents to the screen datafileReader.c will open the file "datafile.dat#file" and print the contents to the screen
Within the tarball you'll also find the pre-existing datafile that I used for my own testing, as well as the original file written by fileReader. I suggest trying the ones I have generated as well as versions manually generated. If it's of any use, the junk value I get when attempting to read the 123 from the file is: 560491635
-Jay
Attachment:
packfile.tar.gz
Description: GNU Zip compressed data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |