Binary data file compatibility across machines

Michael D Stiber stiber at cs.ucla.edu
Sat Nov 24 08:46:00 AEST 1990


On different machines, the implementation of C data types is different.
I forget what fixed types' lengths are, but I know that at least some of
them may vary.  I also know that doubles can have different encoding
schemes (ie, IEEE vs. DEC).  Then, there's little endian machines versus
big endian ones.

So, my question is this:  Say you want to share data files among
different machines.  You also want to be able to use the same code on
each machine.  Therefore, you want to have either a uniform file format,
or you want the code to be able to figure out what the file format is,
and convert it to the native data type representation.  Now, one alternative
would be ASCII files --- this is guaranteed to work (assuming that you
can get C on an IBM 3090 to write ASCII).  However, in my application,
ASCII would produce files that are way too huge --- I must use a binary
format.  So, is there an already-existing, standard solution to this
problem of binary data file transfer?
--
			    Michael Stiber
			  stiber at cs.ucla.edu
		   ...{ucbvax,ihpn4}!ucla-cs!stiber
		     UCLA Computer Science Dept.



More information about the Comp.lang.c mailing list