Re: pass several filenames to the subroutine
- From: Ian Bush <I.J.Bush@xxxxxxxxxxxxxxx>
- Date: Fri, 30 Jun 2006 10:14:41 +0000
Hi Mike,
Mike wrote:
Hi,
program main
character*80,allocatable :: fname(:)
allocate(fname(3))
fname(1)="a1.dat"
fname(2)="a2.dat"
fname(3)="a3.dat"
print *,fname
call tt(fname)
stop
end
subroutine tt(fname)
character*(*) fname(:)
print *,fname
return
end
After compiled, it shows
"Warning: In the call to TT, actual argument #1 is character valued and
is being passed to a non-character dummy argument."
Well I can only see one thing wrong with this, but if it has triggered the above
error message its not the most helpful compiler to say the least.
To use the colon syntax for a dummy argument you need in interface in scope
at the calling point. So one of the following must hold, otherwise anything
can happen
1) tt is a module procedure ( i.e. in a module )
2) tt is a contained subprogram
3) In the (sub-)program that calls tt there should be in interface block for
tt
Ian
.
- References:
- pass several filenames to the subroutine
- From: Mike
- pass several filenames to the subroutine
- Prev by Date: Re: WRITE, FORMAT problem
- Next by Date: Re: removing blanks from a file
- Previous by thread: pass several filenames to the subroutine
- Next by thread: WRITE, FORMAT problem
- Index(es):
Relevant Pages
|