As I see it, there's a
"In general" it works as it should.
*BUT* if one of the bytes in the file is 0x80 it returns 0xac20 = '€'.
This is seen: STEP-mode / Variables / doubleclick the return-var: correct hex chars return double-byte-chars 0x??00, while for 0x80 0xAC20 is returned.
This interpreted by hexdump($bin, 0, 'b') returns '3f', i.e. '?'. (While '80' is to expect)
OK: to verify for illegal chars I just created a file with "writefile (..., ..., 'a', 'b')" [append, binary],
with data = chr(0) . chr(1) . ... . chr(255);
The written file is correct up to 7f, but x'80' and *many* following fom x'80' to x'9f' are replaced by x'3f'. The rest x'a0' to x'ff' seems to be ok.
Just verified: the data string to be written by writefile correctly contains x'80', so the bad boy *is* writefile.binary!
I'd call this a
A test with readfile.bin for x'80818283' shows the same wrong pattern as writefile.bin: x'3f813f3f'.
The result: *any* script using readfile/writefile binary *can* fail.
I used BitnessDetector.xys - und suddenly it returned garbage! Reason: the 1st pointer "usually" it x'b8' (OK!), while I happened to test a program with x'80'. Bad bad bad. Had to start searching...
In the end: what's to do? Can this be repaired?
Regards, Peter
XYplorer Beta Club