passing command line argument as parameters

passing command line argument as parameters

I have a routine to get 4 command line argument:
module chk_argumnt
CONTAINS
subroutine chk(x,y)
implicit none
integer::ac
real*4::x,y!,v_a,v_b,e_a,e_b
character(4)::cx,cy,atn1,atn2
! ac=command_argument_count()
write(*,*)command_argument_count()
call get_command_argument(1,cx)
call get_command_argument(2,cy)
call get_command_argument(3,atn1)
call get_command_argument(4,atn2)
read(cy,*)y
read(cx,*)x
write(*,*)atn1,cx,atn2,cy
write(*,*)"from module",x,y
end subroutine chk
end module chk_argumnt

now i want to use them in another routine to initialize variable/
parameters:

program main
use chk_argumnt

real*4::tx=x*10,ty=y*10
! real*4,parameter::tx=x*10,ty=y*10
call chk(x,y)
write(*,*) x
write(*,*) y

end program main

but i cannot do that. What my aim is to supply the main four
parameters from commandline. how can i do that?

3 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

Why not just...

print "input comand 1"
read (*,*) cm1
print "input comand 2"
read (*,*) cm2

and so forth?

you can validate the values after...

Ricardo Reis
'Non Serviam'
@ http://www.lasef.ist.utl.pt
@ http://www.radiozero.pt
@ http://rreis.tumblr.com
@ http://www.flickr.com/photos/rreis

This is a duplicate thread. the active version is here:

http://software.intel.com/en-us/forums/showthread.php?t=64753

-Zaak

Laisser un commentaire

Veuillez ouvrir une session pour ajouter un commentaire. Pas encore membre ? Rejoignez-nous dès aujourd’hui