Binary file compitability

Siping Liu siping at cathedral.cerc.wvu.wvnet.edu
Tue Jan 8 07:06:11 AEST 1991


Can someone tell me how to read (in c code) a binary file which was
writen on a different structured machine/OS?
I know I can use functions like htonl, htons, etc to partly solve this
problem (My program running on sun4 can read a binary file writen on
a VAX 3200. The file contains some values of integer and float types).

But I do not know how to translate a value of the type "double" to/from
the network format. Even though htonl/ntohl works fine, they were not used for
this kind of purpose but for simplifying the manipulation of names and
addresses on the network. I am kind of expecting to find something like
"hton_int", "hton_float", etc. type-oriented translation routines.

Thanks in advance.

Siping Liu.
siping at cerc.wvu.wvnet.edu



More information about the Comp.unix.questions mailing list