in reply to Re^2: Test binary equality?
in thread Test binary equality?
All for places in the file should be exact copies of eachother, as in all 4 elements of the array should now contain the same exact binary data.
(You meant "all four places", right?) But your hexdump of the device/file indicates that the third block of 512 bytes (starting at offset 0x200) is different from the other three (starting at 0, 0x100 and 0x300).
Meanwhile, in your code snippet, I'm having trouble tracking your intent with the four "sysseek/sysread" pairs -- looks like the first two amount to reading the same block twice (?? -- was that a copy/paste error?).
And as for the third and fourth pairs, you didn't mention how big the file actually is, and in any case, seeking from the end of the file seems like an unnecessary complication (possibly a mistake).
Since the first two reads (first two elements of the array) are in fact the exact same data (from the same position in the file), your initial "if" block is never entered. (And why did you say if (!($SB[0] eq $SB[1])) instead of the simpler if ( $SB[0] ne $SB[1] )?)
So, what's the problem again? I don't think it's the "eq" (or "ne") comparison... I think it's a mistake in how you are reading the data from the file.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Test binary equality?
by exodist (Monk) on Jun 21, 2007 at 03:50 UTC |