Xref: utzoo comp.unix.questions:27902 comp.lang.c:35080 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!wuarchive!udel!haven!cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!cathedral!siping From: siping@cathedral.cerc.wvu.wvnet.edu (Siping Liu) Newsgroups: comp.unix.questions,comp.lang.c Subject: Binary file compitability Message-ID: <1157@babcock.cerc.wvu.wvnet.edu> Date: 7 Jan 91 20:06:11 GMT Sender: news@cerc.wvu.wvnet.edu Followup-To: poster Lines: 16 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@cerc.wvu.wvnet.edu