read_characters - Read a file character by character
The read_characters module defines a derived type with accompanying routines to read a file character by character. It uses features of Fortran 2003 to define an object-oriented interface and is meant as a basic class for more sophisticated modules.
The module defines a single data type, CHARACTER_STREAM, and several functions and subroutines:
The name of the module
The class defining the functionality
Parameters defining the type of result from the get method.
Open the file "filename" using an unused LU-number. If some error occurs, the argument "error" is set to true.
The variable by which to reference the file
The name of the file to open
Argument indicating whether opening the file was successful or not. Note that the file is opened with read/write access (though not explicitly) and that it is opened in such a way that the record length is 4 bytes. If this is not possible (for any number of reasons), an error is returned.
Close the file that was opened as a stream.
The variable by which to reference the file
Get the next character from the file. The type argument indicates if it is an ordinary character, end-of-line or end-of-file.
The variable by which to reference the file
The character that was read (if type is set to single_character.
Indicator, one of: single_character, end_of_line, end_of_file or read_error.
Copyright © 2012 Arjen Markus <arjenmarkus@sourceforge.net>