Date: Mon, 01 Aug 1994 13:30:34 +0100 From: "Th. Eifert" Subject: Re: help with reading floats from file To: djgpp AT sun DOT soe DOT clarkson DOT edu Reply-To: eifert AT rz DOT rwth-aachen DOT de Organization: Rechenzentrum RWTH Aachen > > I have trouble reading binary floating point data (4bytes/value) from a > > file generated on a sun/unix into my code compiled with djgpp. > > For starters, Suns are big-endian and i386 are little-endian, so > binary formats in general (even integers) are not going to be > compatible. > > Secondly, floating point binary formats aren't guaranteed to be the > same across platforms. > > You're best bet is to convert the values to strings for file storage. > > > To be more general: all machines, that support IEEE-conformant floating point representation (e.g. Silicon Graphics, IBM, SUN ...) have no problems to exchange floats among each other using binary transfer. Just those machines, that use a non-standardized format, make us the problems mentioned above. Thomas +------------------------------------------------------------------+ | Thomas Eifert | | | | Aachen University of Technology RWTH Aachen | | Computing Center Rechenzentrum | | Seffenter Weg 23 | | D-52074 Aachen | | | | E-Mail: eifert AT rz DOT RWTH-Aachen DOT de Tel.: (0241) 80-4890 | | Fax.: (0241) 888-134 | +------------------------------------------------------------------+