Is it Fortran-standard compliant to read a tabs-delimited Ascii file like this one:
0.11 0.12 0.45
(where the space is actually a tab) with list-directed input like this:
read(11,*) real1,real2,real3
A more interesting question than a first glance might suggest ...
The standard stipulates that blanks are to be recognised as value separators for list-directed input. In Table 3.1 'Special Characters' of (my version of the draft of) the standard a space is denoted Blank character, but there is no further explanation or definition of blank. So a space is definitely a blank inside the source of a Fortran program.
It is well known (??) that the tab character is not part of the Fortran character set, and some compilers will, by default, object to its presence in source files (outside character variable contexts). But I can't see any anyone writing a compiler that would fail to recognise a tab character as a blank for list-directed input of a list of numbers.
I think the answer to the question is
Whether or not a tab character is a value separator for an input list is processor dependent (i.e. it's left up to the compiler writer) so the standard doesn't stipulate that you can absolutely rely on this behaviour.
but I'll be interested to see what the language lawyers have to contribute on this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With