Strings and I/O

A CHARACTER has a fixed length and pads what is assigned to it, so the string lessons start there and go through INDEX, SCAN and the building of a name from parts. The rest of the part is the input and output a real program needs: the format descriptors and their reversion, list-directed reads, text, unformatted, direct-access and internal files, NAMELIST, and the IOSTAT that turns a missing file into a message rather than a crash.

046 Strings: length, TRIM, concatenation a CHARACTER(LEN=n) is fixed, LEN, LEN_TRIM, TRIM, ADJUSTL and the padding of an assignment Open 047 INDEX, SCAN, VERIFY and the string tools INDEX and its BACK argument, SCAN, VERIFY, a loop over the characters and a word count Open 048 Building strings and internal files concatenation and TRIM in a loop, writing into a CHARACTER variable, and a name built from parts Open 049 Formatted output with I, F, E, A, L, X a format string, the I, F, E, A, L and X descriptors, and a table that lines up Open 050 Format reversion, repeat counts and scale factors repeat counts, reversion when the list is longer, the P scale factor, G0 and the T edit descriptor Open 051 List-directed I/O PRINT * and READ *, the widths gfortran picks, a namelist-free record and the limits of the list Open 052 Reading input from stdin READ *, READ(unit, *) from unit 5, the end-of-file condition and a loop that reads records Open 053 Writing and reading text files OPEN, WRITE, REWIND, CLOSE, the STATUS and ACTION keywords, and a file written then read back Open 054 Unformatted and stream I/O FORM="UNFORMATTED", ACCESS="STREAM", a binary record and the bytes a REAL64 takes Open 055 Direct-access files ACCESS="DIRECT" and RECL, a record replaced in place, and the size a record needs Open 056 NAMELIST I/O a NAMELIST group, what the file looks like, and a configuration read without a format Open 057 IOSTAT, IOMSG and file inquiry IOSTAT and its non-zero value, IOMSG, INQUIRE and a missing file that is not a crash Open 058 Internal files and parsing records a CHARACTER variable as a unit, WRITE to it then READ from it, and a record split into fields Open

Lessons