Maurice Lombardi wrote:
... snip ...
I fully agree with this analysis. I has similar problems while rereading with gpc 16 bits integer files which contained experimental data or results of computations written by BP: shortint was one solution, but integer(16) is definitely better because it is clear, explicit and permanent.
The problem of reading and writing other systems binary files always exists, in any language. The only safe and universal method is to read and write text files, and even then there are potential problems.
For binaries, even in the C world, it is NOT recommended to read things as integers, etc., but rather as byte sequences to be packed and unpacked by explicit code. That way the operations revolve around the external data format, not the internal format.