02.07.2014 Views

Intel(R) Fortran Compiler for Linux* Systems User's Guide Volume I ...

Intel(R) Fortran Compiler for Linux* Systems User's Guide Volume I ...

Intel(R) Fortran Compiler for Linux* Systems User's Guide Volume I ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Intel</strong>® <strong>Fortran</strong> <strong>Compiler</strong> <strong>for</strong> <strong>Linux*</strong> <strong>Systems</strong> <strong>User's</strong> <strong>Guide</strong> <strong>Volume</strong> I: Building<br />

Applications<br />

write(10) c8<br />

write(10) c4<br />

close(10)<br />

C read big endian data and operate with them on<br />

C little endian machine<br />

open(100,file='big.tmp',<strong>for</strong>m='un<strong>for</strong>matted')<br />

read(100) cc8<br />

read(100) cc4<br />

C<br />

Any operation with data, which have been read<br />

C . . .<br />

close(100)<br />

stop<br />

end<br />

Now compare lit.tmp and big.tmp files with the help of od utility.<br />

> od -t x4 lit.tmp<br />

0000000 00000008 00000315 00000000 00000008<br />

0000020 00000004 000001c8 00000004<br />

0000034<br />

> od -t x4 big.tmp<br />

0000000 08000000 00000000 15030000 08000000<br />

0000020 04000000 c8010000 04000000<br />

0000034<br />

You can see that the byte order is different in these files.<br />

OPEN Statement CONVERT Method<br />

You can use this method to specify a non-native numeric <strong>for</strong>mat <strong>for</strong> each<br />

specified unit number. This method requires an explicit file OPEN statement to<br />

specify the numeric <strong>for</strong>mat of the file <strong>for</strong> that unit number.<br />

This method takes precedence over the OPTIONS statement and the compiler<br />

option -convert keyword method, but has a lower precedence than the<br />

environment variable methods.<br />

For example, the following source code shows how the OPEN statement would<br />

be coded to read un<strong>for</strong>matted VAXD numeric data from unit 15, which might be<br />

processed and possibly written in native little endian <strong>for</strong>mat to unit 20. (Tthe<br />

absence of the CONVERT keyword or environment variables FORT_CONVERT20,<br />

132

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!