Thu 20 Feb 2014 06:03:11 PM UTC, original submission:
The fread function is not behaving correctly when skipping after a read.
With the following data in a binary file (attached):
000102030405060708090A0B0C0D0E0F
Reading it with the following commands:
should yield (in hex):
but returns instead (in hex):
It is interesting to note that if called sequentially like this with skip=1:
the correct sequence is read.
However, if called like this:
it yields a strange sequence:
Note the first two bytes being read correctly, and then the skip is forgotten and the rest of the file is read. The expected sequence would be instead:
Finally, when doing the following:
octave crashes with the message "Aborted".
It is as if it is getting confused between bytes to read and elements to read, and that the logic of whether to skip or not is broken.
|