Re: opening char variable data file
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Tue, 30 Oct 2007 18:20:08 GMT
e p chandler wrote:
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.
It's always hard to use list directed formatting (the second * in
your write statement) to look at character variables. You never
know for sure whether those quotes were added by the processor
(because DELIM = QUOTE for *) or whether they are part of the
variable. Try printing it out with a real format, something like
write (*,'(a,">>>",a20,"<<)') "Opening ",file_name_use
and see what you get.
In general, for Fortran use you don't want quotes as part of a
value, they are the things that surround the value when you
write out a literal, but they aren't part of the value, any more
than the "E" in 1.0E10 is part of the value.
*** Hendrickson
.
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
- Follow-Ups:
- Re: opening char variable data file
- From: Terence
- Re: opening char variable data file
- References:
- opening char variable data file
- From: GT
- Re: opening char variable data file
- From: e p chandler
- opening char variable data file
- Prev by Date: Re: IDE for Linux for C/C++ & Fortran
- Next by Date: Re: End of file
- Previous by thread: Re: opening char variable data file
- Next by thread: Re: opening char variable data file
- Index(es):