Oct 4, 2013, 3:16 PM
I would probably first try to use the read and seek functions, rather than sysread, to read the required bytes.
Re: [ric79] sysread and Little Endian
This is a basic syntax example I gave on this forum a few weeks ago, you can adapt it to your needs:
DB<1> $c = "The quick brown fox jumps over the lazy dog."
DB<2> open $fh, "<", \$c or die "could not open $c $!"; # opens a reference to the $c variable as a filehandler
DB<3> seek $fh, 10, "00"; # positions the filehandler on the 10th byte
DB<4> read $fh, $out, 10; # reads 10 bytes from position 10
DB<5> print $out;
For the Little Endian/Big Endian thing, hmm, we would probably need to know more about your machine architecture (64 bits, 48 bits, 64 bits, more ?), I am not even sure you need to care about it if you use the read function (last time I had to deal with such problems was at least 6 years ago, I don't remember well enough what I had to do, except that I had to make a bit of experiment to get it right, but it was not so complicated to get it right once I understood the format). One possible clue: the h and H templates of the pack and unpack function might be what you are looking for.
I might have a quick look at it next Monday when I am back to work, where I have access to a Little Endian platform.