[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Byte Swapping?



On Tuesday 14 May 2002 9:16 pm, you wrote:

>     I have a problem reading a file in solaris. The file is a large
> chunk of double precision binary data. In Linux, I can read the file
> with a simple fread statement:
>  nread = fread(raw, sizeof(double),(unsigned)rows*cols, fp) ;
> where raw is an allocated double array of size rows*cols.

The easiest and most guaranteed way is to use an ASCII representation. Read 
in a loop, printf() -> read in a loop atof().

I can't remember offhand what the hardware way to do it is. I suspect the 
i386 doubles are 48bit IEEE, and the UltraSparc II are 64 bit IEEE, but ICBW.
Byte swapping is unlikely to do it.
___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.