| Re: Unformatted data portability: Digital UNIX-->Windows 95 [message #11333 is a reply to message #11239] |
Mon, 23 March 1998 00:00   |
dors
Messages: 8 Registered: June 1994
|
Junior Member |
|
|
Hi,
You are correct, FORTRAN outputs some weird marker bytes to files. On
other platforms where "/F77" isn't available you will have to keep
track of this. Using od (octal dump) on a test data file from your
shell, will help you find these marker bytes if you don't have a
manual which provides that information.
To make your code architeture independent, your best bet is to create
a case statement on "!version.os". In the various cases ("OSF",
"sunos", ...) have the architecture specific code to transform the
input data such that your output data is the same no matter what
architecture you are using. You will always have to be aware of the
architecture of the machine where the data file was written.
Prepending an ASCII header to your data files containing architecture
of the file creator will facilitate this. Then you can perform the
appropriate BYTEORDER or SWAP_ENDIAN commands to switch byte ordering
differences and appropriately remove FORTRAN codes from the data file,
if present. When writing ASCII headers to binary data files, I find
it useful to include the length in bytes or the number of lines of the
header as the first line of the header for easy decoding later.
Although I have not done this myself, I believe the use of CDF files
will provide a seemless mechanism to pass data between architectures.
So if you have FORTRAN libraries available to write CDF, you might
look into this solution.
Hope this helps,
Eric
--
============================================================ ================
| Eric E. Dors | Internet:dors@gamma.physics.uiowa.edu |
| University of Iowa | Web: http://delta.physics.uiowa.edu/~dors |
| 203 Van Allen Hall | Office: (319) 335-3828 |
| Iowa City, IA 52242 | Home: (319) 351-0887 |
============================================================ ================
|
|
|
|