Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

Question about tabs as separators in list-directed read

grtoro
Beginner
396 Views
Here is my question:

Suppose a particular a file contains the following line (pasted from you know which program):

124

I have the instruction (once):
READ(5,*) A,B,C

Do I get values of 1., 2., and 0.?
Do I get values of 1., 2., and 4.?

I am using the latest Intel Fortran compiler (or composer, I guess).

Does the fortran standard say anything about the repeated tabs should be treated (one separator or two)?

Thanks,

Gabriel

0 Kudos
1 Reply
Steven_L_Intel1
Employee
396 Views
The Fortran standard doesn't include tabs as valid in list-directed input - indeed, tab is not even in the Fortran character set. However, the standard treats whitespace, "one or more contiguous blanks", as a value separator. Intel Fortran treats tabs identically to blanks in list-directed input, so your example would get values 1, 2 and 4. Since your input is non-standard, the results are implementation-dependent.

My advice is not to use tabs in list-directed input.
0 Kudos
Reply