[EMAIL PROTECTED] wrote: > Hi! > > I'm writing some 68k modules, for disassembly, assembly, reading > instructions, analysing instructions, etc. > > The package I'm stuck on is supposed to read a 16bit instruction, and > then break it down into an array, with each element seperated. > > So far, I'm trying to read 16bits, at an offset specified by the > user, but for some reason, all I get is more white spaces infront of > the first 16bits in the file. > > open SOURCE, "$File" or > die "Cannot open $File\n"; > > binmode SOURCE; > > read SOURCE, $Instr, 2, $Offset;
Nope. The offset argument to read() specifies the offset in your buffer where you want the data to be placed. Reading always proceeds from the file's current position, which you manipulate with the seek() function. You want something like this: use Fcntl 'SEEK_SET'; seek SOURCE, $Offset, SEEK_SET; read SOURCE, $Instr, 2; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>