Re: opening char variable data file



On Oct 30, 1:53 pm, GT <gthib...@xxxxxxxx> wrote:
Hi all,

I am not sure why the following is not working, maybe someone will point out
the obvious to me ?

I set
file_name_use as WORK/aos__files.dat

Please show us the statement you use to set the contents of this
variable.


indeed
write (*,*)"Opening ",file_name_use
does produce
Opening "WORK/aos__files.dat"


If this is EXACTLY what you see then you have enclosed the file name
in quote marks inside of whatever specifies the contents of
file_name_use.

and
call system ("more "//file_name_use)
does
aos0412.all
AOS0412.ALL2
aos.430
bor53402.gps
bor53430.gps
bor53461.gps
.
.
.
which is correct


Perhaps this works because the SHELL which system invokes interprets
and removes the enclosing quote marks?


so, why does
open(unit=35,file=file_name_use)
give me
Fortran runtime error: No such file or directory
???

Anybody's guess?

See above.

If I am not sure what a character variable contains, I add a
diagnostic print statement such as

write(*,*) 'file_name_use = ' // '|' // file_name_use // '|'

The vertical bar characters help show me the actual length of the
character variable. If one or both of them disappears, moves around on
the screen, etc. I have a clue that the contents are not what I
expected!

HTH

-- elliot

.


Quantcast