See following sample script
In order to use Read[_Real, Byte, opt___Rule], you have to fix EOF detection errata in src/tfwrite.f
Index: src/tfwrite.f
===================================================================
--- src/tfwrite.f.orig
+++ src/tfwrite.f
@@ -1190,6 +1190,7 @@
return
101 iax=iaxeof
itx=ntfsymbol
+ irtc=0
return
end
===================================================================
--- SADScript ---
FFS;
stdout = 6;
fn = MkSecureTemp[Directory->"/tmp", Prefix->"test_binary"];
tbl0 = Table[i, {i, 0, 255}];
str0 = FromCharacterCode[tbl0];
Print["Create 256bytes binary file[", fn, "]"];
fp = OpenWrite[fn];
WriteString[fp,str0];
Close[fp];
Print["Dump file[", fn, "]"];
System["env LANG=C ls -l "//fn]; System["od -t x1 "//fn];
Print["Read file[", fn, "] as Character stream"];
fp = OpenRead[fn];
str1 = "";
While[c = Read[fp, 1*Character]; c <=> EndOfFile,
str1 = str1//c];
Close[fp];
tbl1 = ToCharacterCode[str1];
StandardForm[
i = -1;
Scan[With[{c = #},
i += 1;
If[i === 0, Print["Dump readed file(length ", Length[tbl1], ")"]];
If[Mod[i, 16] === 0, WriteString[stdout, (" "//i)[-4,-1], ": "]];
WriteString[stdout, " ", (" "//c)[-3,-1]];
If[Mod[i, 16] === 15, WriteString[stdout, "\n"]];
]&, tbl1];
If[Mod[i, 16] <=> 15, WriteString[stdout, "\n"]];
];
Print["Read file[", fn, "] as Byte stream"];
fp = OpenRead[fn];
tbl2 = {};
While[c = Read[fp, Byte]; c <=> EndOfFile,
AppendTo[tbl2, c]];
Close[fp];
StandardForm[
i = -1;
Scan[With[{c = #},
i += 1;
If[i === 0, Print["Dump readed file(length ", Length[tbl2], ")"]];
If[Mod[i, 16] === 0, WriteString[stdout, (" "//i)[-4,-1], ": "]];
WriteString[stdout, " ", (" "//c)[-3,-1]];
If[Mod[i, 16] === 15, WriteString[stdout, "\n"]];
]&, tbl2];
If[Mod[i, 16] <=> 15, WriteString[stdout, "\n"]];
];
System["rm "//fn];
Exit[];
! End of File
--- SADScript ---