tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: big endian C fread routine
@ 1996-09-17 12:59 Lorne J. Covington
  0 siblings, 0 replies; only message in thread
From: Lorne J. Covington @ 1996-09-17 12:59 UTC (permalink / raw)
  To: tru64-unix-managers

Original post:
>
> We have a set of FORTRAN codes which are set up to function in a heterogeneous
> workstation enviroment.   The OSF port of the codes can share binary information
> with other platforms as long as the codes are compiled with the f77 option
> "-convert big_endian" option.
>
> A problem arises in that one of our X11 programs, which has been written in C,
> needs to read some of these FORTRAN written big endian binary files.  We can always
> assume that the files are in big endian format.
>
> Does anyone have a set of filters, or a big endian "fread", that we can include in the
C
> source to do the big endian to little endian conversion?

Thanks to the following who responded:
..David Bremner <bremner@cs.mcgill.ca>
..Kurt Carlson <SXKAC@orca.alaska.edu>
..Serge Munhoven <munhoven@olive.msm.ulg.ac.be>
..Kurt Knochner <Kurt.Knochner@Physik.TU-Muenchen.DE>
..Ken Teh <teh@chinook.phy.anl.gov>

Several of the respondents sent code that showed how to flip long int data, but
none had a solution for floats and doubles.  The gist of the reccomendations was
that we would have to handle the conversions on a word by word basis and there is
not a generic solution.

One of the better reccomendations was to write the binary file using XDR filters to
save the file in architecture independent form.  We have actual done this with
one of our newer codes, but unfortunatly can not do this with the older code because
the files we need to read already exist in big_endian format.


-- 
Lorne J. Covington, Senior Nuclear Engineer        |Email: ljc@soa.com
Studsvik of America                                |(617) 965-1819 (voice)
1087 Beacon St, Suite 301                          |(617) 965-7549 (fax)
Newton, MA 02159                                   |

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-09-17 12:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-09-17 12:59 SUMMARY: big endian C fread routine Lorne J. Covington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox