TheMartianGeek has asked for the wisdom of the Perl Monks concerning the following question:
"$GFXFileBits" is the variable that holds the OR'd bits; it should always have a value of 0x0, 0x80, 0x100, 0x180, 0x200, or 0x280. And yes, I know that $i isn't actually used for anything; it was somewhat of a debugging variable that I haven't removed yet. Can anyone help me out here? I've looked all around for more specific documentation on the read() function and binary file I/O, but I haven't turned up much. I know that code is incorrect, but after a long period of trial and error, I haven't really gotten anywhere. Oh, and yes, I am using binmode on both the input and output file handles.$i = 0; $TileData = 0x0000; while(!(eof(IN))) { $BytesRead = read(IN, $TileData, 2); unless($BytesRead != 2) { $NewTileData = (($TileData & 0xFC7F) | ($GFXFileBits)); print OUT $NewTileData; $i++; next; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about binary file I/O
by BrowserUk (Patriarch) on Feb 06, 2011 at 00:32 UTC | |
|
Re: Question about binary file I/O
by eyepopslikeamosquito (Archbishop) on Feb 06, 2011 at 00:44 UTC | |
by TheMartianGeek (Acolyte) on Feb 06, 2011 at 02:38 UTC | |
by eyepopslikeamosquito (Archbishop) on Feb 06, 2011 at 04:00 UTC | |
by TheMartianGeek (Acolyte) on Feb 06, 2011 at 16:10 UTC | |
by TheMartianGeek (Acolyte) on Feb 06, 2011 at 06:05 UTC | |
by eyepopslikeamosquito (Archbishop) on Feb 06, 2011 at 07:18 UTC | |
by TheMartianGeek (Acolyte) on Mar 02, 2011 at 05:21 UTC | |
by roboticus (Chancellor) on Mar 02, 2011 at 11:13 UTC | |
by james2vegas (Chaplain) on Feb 06, 2011 at 03:03 UTC | |
|
Re: Question about binary file I/O
by james2vegas (Chaplain) on Feb 06, 2011 at 00:37 UTC | |
by TheMartianGeek (Acolyte) on Mar 05, 2011 at 07:38 UTC | |
by tilly (Archbishop) on Mar 05, 2011 at 08:27 UTC | |
by ikegami (Patriarch) on Mar 05, 2011 at 09:16 UTC | |
by tilly (Archbishop) on Mar 05, 2011 at 10:45 UTC | |
|