M
Mark Wirdnam
Hello!
I've given this problem a weekend of consideration without conclusion.
I'm trying to use the "read"-command, for step-by-step reading from a
binary file. On my computer at work (Mac OS X, perl 5.6.0), the
scripts I write work. At home on Redhat Linux 8, perl 5.8.0, the same
scripts don't work - with the same files!
The symptoms are as if one read doesn't leave the file-pointer in the
right place for the second read, bytes are getting lost.
Here's an example of one such script:
open H, shift;
read H, $grab, 12;
($riff, $size, $wave) = unpack "A4VA4", $grab;
print "see whether it's a .wav: $riff - $size - $wave\n";
print "finding the chunks...\n";
$check = read H, $grab, 8;
while ($check == 8) {
($cid, $csize) = unpack "A4V", $grab;
print "finding a chunk $cid of size $csize.\n";
read H, $grab, $csize; # brings me to the next chunk
$check = read H, $grab, 8; }
Maybe you can see the mistake i'm making?
Thank you,
Mark
I've given this problem a weekend of consideration without conclusion.
I'm trying to use the "read"-command, for step-by-step reading from a
binary file. On my computer at work (Mac OS X, perl 5.6.0), the
scripts I write work. At home on Redhat Linux 8, perl 5.8.0, the same
scripts don't work - with the same files!
The symptoms are as if one read doesn't leave the file-pointer in the
right place for the second read, bytes are getting lost.
Here's an example of one such script:
open H, shift;
read H, $grab, 12;
($riff, $size, $wave) = unpack "A4VA4", $grab;
print "see whether it's a .wav: $riff - $size - $wave\n";
print "finding the chunks...\n";
$check = read H, $grab, 8;
while ($check == 8) {
($cid, $csize) = unpack "A4V", $grab;
print "finding a chunk $cid of size $csize.\n";
read H, $grab, $csize; # brings me to the next chunk
$check = read H, $grab, 8; }
Maybe you can see the mistake i'm making?
Thank you,
Mark