Fortran I/O channels are in terms of unit numbers. The underlying SunOS operating system does not deal with unit numbers but with file descriptors. The Fortran runtime system translates from one to the other, so most Fortran programs do not have to recognize file descriptors.
Many C programs use a set of subroutines, called standard I/O (or stdio). Many functions of Fortran I/O use standard I/O, which in turn uses operating system I/O calls. Some of the characteristics of these I/O systems are listed in the following table.
Table 11–2 Comparing I/O Between Fortran and C
|
Fortran Units |
Standard I/O File Pointers |
File Descriptors |
---|---|---|---|
Files Open |
Opened for reading and writing |
Opened for reading, or for writing, or for both; or opened for appending; See open(2) |
Opened for reading, or for writing, or opened for both |
Attributes |
Formatted or unformatted |
Always unformatted, but can be read or written with format-interpreting routines |
Always unformatted |
Access |
Direct or sequential |
Direct access if the physical file representation is direct access, but can always be read sequentially |
Direct access if the physical file representation is direct access, but can always be read sequentially |
Structure |
Record |
Byte stream |
Byte stream |
Form |
Arbitrary nonnegative integers from 0-2147483647 |
Pointers to structures in the user’s address space |
Integers from 0-1023 |