'(*)' and List Directed I/O



One of the things that has always bothered me about formatted I/O in
fortran (from f77 to f2003) is that different read statements are
required for list-directed I/O and I/O with explicit formats. I use
codes that read data files that have the formats intersperced with
the data. For example:

....
(4i4)
1 2 3 4
(5i5)
12345 1234 123 12 1
.....

The codes that read these data files do the obvious thing and read
the format into a character variable, and then use that character
variable to read the data.

When creating or modifying data files like this manually, it would
be convenient to be able to specify list directed I/O. For example,

(*)
12345,1234,123,12,1

Instead of something that requires you to count columns. This would
also allow for repeat counts in the data, arbitrary line breaks, and
so on. Fortran does not allow list directed I/O in this way.
Instead, the programs that read this data must do something like

read(nin,'(a') cfmt
if ( cfmt .eq. '(*)' ) then
read(nin,*) data
else
read(nin,cfmt) data
endif

Is there some reason why Fortran I/O is done the way it is in this
case? Why was list-directed I/O done in the special-case way that
it was rather than the (to me) more obvious and general way? Is
there any reason why it could not be changed now to include the
general way? Is there any chance that this could be submitted to
the J3 committee and it would be included in some future revision of
the language?

$.02 -Ron Shepard
.



Relevant Pages

  • Re: Heavy I/O blocks FreeBSD box for several seconds
    ... stuck for seconds while one of the processes producing heavy I/O is running, ... than cpu intensive tasks, because they are expected to only issue a i/o request ... running GENERIC, preemption *should* be enabled. ...
    (freebsd-questions)
  • Re: Heavy I/O blocks FreeBSD box for several seconds
    ... stuck for seconds while one of the processes producing heavy I/O is running, ... than cpu intensive tasks, because they are expected to only issue a i/o request ... running GENERIC, preemption *should* be enabled. ...
    (freebsd-current)
  • Re: (*) and List Directed I/O
    ... >The codes that read these data files do the obvious thing and read ... and you don't have to worry about formats at all. ... Fortran does not allow list directed I/O in this way. ...
    (comp.lang.fortran)
  • Re: NT_SUCCESS propagation
    ... I/O completion status can be anything, ... NTSTATUS are mapped to distinctive Win32 error codes, ... appropriate status for a request being executed. ...
    (microsoft.public.development.device.drivers)
  • Re: NEW_LINE()
    ... I want to do formatted I/O. ... *independent* of the distinction between binary and text streams. ... I don't recall ever using text streams in my own code. ... in C, which has formats too. ...
    (comp.lang.fortran)