Re: transfering data files [message #16652 is a reply to message #16636] |
Mon, 09 August 1999 00:00   |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Kenneth Mankoff (mankoff@nagik.cs.colorado.edu) writes:
> I need to transfer idl ".dat" files between computers. One is a Sun
> running solaris, the other is a Dell laptop running Linux. The sun has
> IDL5.2, Linux is running IDL5.1. The files are corrupted when transfered,
> unless i copy them to .sav files. Is there any way around this?
I'm presuming that by "dat" files you mean "binary" files.
If so, the files aren't corrupted, the machines you want
to read the files on using different byte ordering. Hence,
binary files are not portable on these machines. See
this article:
http://www.dfanning.com/tips/endian_machines.html
One solution to this problem is to open the files up
on the machine they were created on, and save the files
as XDR binary files. (Use the XDR keyword on the OPENW
statement.) Then read the XDR files on the other machine.
Another solution is to read the data in the normal way,
but then byte swap it to the correct format. You can use
the BYTEORDER function for this.
Still another solution is to open the file on the machine
you want to get the data into with the SWAP_ENDIAN keyword
set on the OPENR statement.
Any (or all) of these methods should help "uncorrupt"
the file. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|