Re: how can i call a compiled fortran code from IDL? [message #33942 is a reply to message #33939] |
Thu, 06 February 2003 10:02   |
Paul Van Delst[1]
Messages: 1157 Registered: April 2002
|
Senior Member |
|
|
mads wrote:
>
> hi all,
> what if i have to use,
> spawn, 'c:\hi\\something.exe'
what about something like:
execution_string = 'c:\hi\' + execution_directory + '\something.exe'
spawn, execution_string
You have to specify (somehow, e.g. via an argument with a default?) what is the directory
that contains the executable, but you would have to identify it somehow in any case.
E.g.:
Given a utility routine:
FUNCTION Valid_String, Input_String
IF ( N_ELEMENTS( Input_String ) EQ 0 ) THEN RETURN, 0
IF ( STRLEN( Input_String ) EQ 0 ) THEN RETURN, 0
RETURN, 1
END
then:
PRO myidlpro, Execution_Directory = Execution_Directory
Default_ExeDir = 'what_now'
IF ( Valid_String( Execution_Directory ) ) THEN $
ExeDir = Execution_Directory $
ELSE $
ExeDir = Default_ExeDir
....do some other stuff...
Execution_String = 'c:\hi\' + ExeDir + '\something.exe'
SPAWN, Execution_String
...do some more stuff
END
So if you don't specify the "Execution_Directory" optional argument, it will default, but
you can specify an alternative if required.
You should search the IDL online dos for "noninteractive use of spawn".
paulv
> now the space that is in "what now" causes a problem. Thats the reason i was
> against spawning. i can solve that by just moving all the files into the
> working directory and just use
> spawn,'something.exe'
> thats how i have solved the problem now
> sincerely
> madhu
--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Ph: (301)763-8000 x7274
Fax:(301)763-8545
|
|
|