Re: transfering data files [message #16641 is a reply to message #16636] |
Tue, 10 August 1999 00:00   |
Kenneth Mankoff
Messages: 42 Registered: August 1999
|
Member |
|
|
Thank you. The /swap_endian keyword works, and solves everthing (for this
problem, at least).
Next question: (which i can figure out with a little trial and
error)... If the files are created (fully) on the Intel laptop, is the
swap_endian keyword still needed?
What happens if i have a file transfered from the Sun to the Dell
(i.e. /swap_endian needed to open it), and i update _only part of the
file_ with an OPENU command. Will the file now still be in "big endian",
or will the SUN part of the file be "big" and the updated Intel part of
the file be "little"?
-=ken=-
On Mon, 9 Aug 1999, David Fanning wrote:
> 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
>
>
|
|
|