Re: Reading binary data whose source code not given [message #2080] |
Wed, 18 May 1994 09:59  |
rlefevre
Messages: 4 Registered: April 1994
|
Junior Member |
|
|
In article <2rd8ft$hn2@mojo.eng.umd.edu> madabhus@eng.umd.edu (Rajiv Madabhushi) writes:
> I have a binary file with a 400 by 400 array. All I know about the
> elements of that array is that they are written as 16-bit 2's complement
> data. The file was created on a pc. I am no sure about what language
> the software that creates this file is written in (and cannot
> find out :-( ).
> None of the above attempts proved successful. (I compared the image plot
> with that from an ascii version of the file. The two plots are completely
> different. The binary data is read in ok - without any keywords - but none
> of the data points are read in correctly.)
> So my question is: is there any way to read such data? I would be willing
> (and I also tried, but unsuccessfully) to read the data element by element.
Yes, I think.
I read data from Unix F77 on my IDL for the PC. I have to use the function
byteorder and keyword /lswap. For example,
readu,unit,isize,data,isize & byteorder, data, /lswap
where isize is the size byte used by f77 unformatted write and data is the
data.
Hope this helps.
----------
Randy J. Lefevre
Return e-mail to rlefevre@tamu.edu
|
|
|