02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

I/O and file handling<br />

File access methods<br />

List-directed I/O<br />

List-directed I/O is similar to formatted I/O in that data undergoes a format conversion when<br />

it is transferred but without the use of a format specification to control formatting. Instead,<br />

data is formatted according to its data type. List-directed I/O is typically used when reading<br />

from standard input and writing to standard output.<br />

List-directed I/O uses the asterisk (*) as a format identifier instead of a list of edit descriptors,<br />

as in the following READ statement, which reads three floating-point values from standard<br />

input:<br />

READ *, A, B, C<br />

List-directed I/O can be performed only on internal files and on formatted, sequential external<br />

files. It works identically for both file types.<br />

Input Input data for list-directed input consists of values separated by one or more blanks, a<br />

slash, or a comma preceded or followed by any number of blanks. (No values may follow the<br />

slash.) An end-of-record also acts as a separator except within a character constant. Leading<br />

blanks in the first record read are not considered to be part of a value separator unless<br />

followed by a slash or comma.<br />

Input values can be any of the values listed in Table 8-1. A blank is indicated by the symbol b.<br />

Table 8-1 Input values for list-directed I/O<br />

Value Meaning<br />

z A null value, indicated by two successive separators with<br />

zero or more intervening blanks (for example, ,b/).<br />

c A literal constant with no embedded blanks. It must be<br />

readable by an I, F, A, orL edit descriptor. Binary, octal, and<br />

hexadecimal data are illegal.<br />

r*c Equivalent to r (an integer) successive occurrences of c in the<br />

input record. For example, 5*0.0 is equivalent to 0.0 0.0<br />

0.0 0.0 0.0.<br />

r*z Equivalent to r successive occurrences of z.<br />

Reading always starts at the beginning of a new record. Records are read until the list is<br />

satisfied, unless a slash in the input record is encountered. The effect of the slash is to<br />

terminate the READ statement after the assignment of the previous value; any remaining data<br />

in the current record is ignored.<br />

178<br />

Chapter 8

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

Saved successfully!

Ooh no, something went wrong!