RAW_IO - Binary I/O with FORTRAN
RAW_IO is an attempt to make a library of routines for
"raw" I/O in FORTRAN. A "raw" file is a binary file, containing pure
data. It is typically read a few bytes at a time, with individual
bytes being reassembled into integers and real values. This is the
sort of file that C programs handle effortlessly. Most FORTRAN
programs are written assuming some helpful structures in the file,
such as a fixed record length, a fixed format, a storage format
that uses 4 bytes for every item, and so on. Most files are not
written with the convenience of FORTRAN programmers in mind!
This is a work in progress, another nice way of saying it doesn't
work too well. But it helps me to organize my ideas, and I often
return here to try to get the code to do a little more of what I
want.
Files you may copy include:
The list of routines includes:
-
B1_TO_SI1 converts one byte to a signed integer.
-
B1_TO_UI1 converts one byte to an unsigned integer.
-
B2_TO_SI2 converts two bytes to a signed integer.
-
B2_TO_UI2 converts two bytes to an unsigned integer.
-
B4_IEEE_TO_R4 converts a 4 byte IEEE word into a real value.
-
B4_TO_SI4 converts four bytes to a signed integer.
-
B4_TO_UI4 converts four bytes to an unsigned integer.
-
BYTE_SWAP_GET gets the current byte swap information.
-
BYTE_SWAP_INFO sets or gets byte swapping information.
-
BYTE_SWAP_SET sets the current byte swap information.
-
CH_IS_PRINTABLE determines if a character is printable.
-
CHVEC_PRINT prints a character vector.
-
GET_UNIT returns a free FORTRAN unit number.
-
R4_TO_B4_IEEE converts a real value to a 4 byte IEEE word.
-
RAW_C_COUNT counts the number of characters in a "raw" file.
-
RAW_C_READ reads N characters from a raw file.
-
RAW_C_WRITE writes N character to a raw file.
-
RAW_OPEN opens a "raw" file.
-
RAW_R4_READ reads the "next" 4 byte real from a raw file.
-
RAW_R8_READ reads the "next" 8 byte real from a raw file.
-
RAW_S_READ reads the "next" string from a raw file.
-
RAW_SI1_READ reads N signed 1 byte integers from a raw file.
-
RAW_SI1_WRITE writes N 1 byte signed integers to a raw file.
-
RAW_SI2_READ reads N 2 byte signed integers from a raw file.
-
RAW_SI2_WRITE writes N 2 byte signed integers to a raw file.
-
RAW_SI4_READ reads N 4 byte signed integers from a raw file.
-
RAW_SI4_WRITE writes N 4 byte signed integers to a raw file.
-
RAW_UI1_READ reads N unsigned 1 byte integers from a raw file.
-
RAW_UI1_WRITE writes N 1 byte unsigned integers to a raw file.
-
RAW_UI2_READ reads N 2 byte unsigned integers from a raw file.
-
RAW_UI2_WRITE writes N 2 byte unsigned integers to a raw file.
-
RAW_UI4_READ reads N 4 byte unsigned integers from a raw file.
-
RAW_UI4_WRITE writes N 4 byte unsigned integers to a raw file.
-
S_BYTE_SWAP swaps the bytes in a string.
-
SI1_TO_B1 converts a signed integer to one byte.
-
SI2_TO_B2 converts a signed integer to two bytes.
-
SI4_TO_B4 converts a signed integer to four bytes.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
-
UI1_TO_B1 converts an unsigned integer to one byte.
-
UI2_TO_B2 converts an unsigned integer to two bytes.
-
UI4_TO_B4 converts an unsigned integer to four bytes.
Return to the FORTRAN software page.
Last revised on 14 November 2001.