Binary data file compatibility across machines

Al Dunbar userAKDU at mts.ucs.UAlberta.CA
Sun Dec 2 04:11:35 AEST 1990


In article <2188 at tuvie.UUCP>, hp at vmars.tuwien.ac.at (Peter Holzer) writes:
>userAKDU at mts.ucs.UAlberta.CA (Al Dunbar) writes:
>
>>In article <2172 at tuvie>, hp at vmars.tuwien.ac.at (Peter Holzer) writes:
>>>stiber at cs.ucla.edu (Michael D Stiber) writes:
>>>
>>>
>>>>On different machines, the implementation of C data types is different.
>><<<deletions>>>
>>>
<<<yet more deletions>>>
>
>EBCDIC machines must convert character data (Both on read and write).
>If they have 8bit-char, 16bit-short, 32bit-long they may read write
>integers in their native format.
 
If you are going to force EBCDIC machines to convert through ASCII
on input and output, why not have all versions of your program
produce identical output? Then you needn't have the short header,
or the "overhead" of decoding it.
 
I guess I misunderstood your original posting to be addressing
a general case of binary file portability. One problem with
your approach (though it appears to work well in your environment)
seems to be that the code must be tailored for each machine
it runs on in order to compensate for architectural differences.
Thus, you may achieve data portability, but have lost program
portability.
 
 
-------------------+-------------------------------------------
Al Dunbar          |
Edmonton, Alberta  |  "this mind left intentionally blank"
CANADA             |          - Manuel Writer
-------------------+-------------------------------------------



More information about the Comp.lang.c mailing list