I try to modify my program to read lines that contain blank charaters (written with space) at the end of the line. I'm using Intel compiler (Fortran 95).
In the program i'm using the command line:
character*(*) line !this is the character line to where we read
...
...
read (unit=11, '(A80)') line
So in the file (*.txt-file), the line is:
R=
The last character of that line is blank character (space).
Is there any way to find out that line is 3 characters long and the last character is blank?
Thanks!
Is there any way to find out that line is 3 characters long and the last character is blank?
I just get character-array : 'R=' with many blank characters in the end.
Well, you could just about use the
size=specifier in a read statement, but it's horribly contrived.The following code allocates (and then reallocates) an allocatable character called line.
For a data file test.dat containing lines
(with the requisite numbers of blanks at the end of each line) it produces, with the square braces [ and ] just to indicate the size of line,