Re: simple .sav doesn't work [message #63886] |
Fri, 21 November 2008 09:00  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On Nov 21, 10:12 am, Reimar Bauer <R.Ba...@fz-juelich.de> wrote:
> loebasboy schrieb:
>
>
>
>> On 21 nov, 16:22, loebasboy <stijn....@gmail.com> wrote:
>>> Hello,
>
>>> at first I wanted to try out the command line arguments of the idl
>>> virtual machine in combination with a simple summation program, just
>>> to test it out...
>
>>> PRO test_sav
>
>>> cla = command_line_args(count = count)
>>> a = cla[0]
>>> b = cla[1]
>
>>> c = a + b
>>> header = string(c)
>>> file = filepath('test.txt', root_dir='d:')
>>> OpenW, lun3, file, /Get_Lun
>>> PrintF, lun3, header
>>> Free_Lun, lun3
>
>>> END
>
>> Sorry for the half message but I hit tab and space too soon.
>> To conclude, I thought the problem was with command line arguments but
>> when I replaced a and b with simple numbers instead of the cla
>> arguments and executed the .sav with virtual machine nothing happend.
>> If I run the program in idl with compile and run, it does what is
>> supposed to do. What am I doing wrong here? Sorry if this is a very
>> stupid question, but it is the end of the week and I'm out of
>> options ;)
>
>> thanks in advance
>
> command line args don't work with vm mode (at least I think it doesn't)
> you have to think on a different way to get your data into the routine
>
> e.g.
> env vars
> an ini file can be used to build an _extra structure
> ( http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl _html/dba...)
> a gui
>
> cheers
> Reimar
command line args should work in the vm (at least I think it does ;^)
Of course, you can't just pass the arguments, you have to use -args
when you call idl:
idl -vm=test_sav.sav -args 5 6
Remember, also, that the args are passed as a string array(!), so your
code will fail there, too. Perhaps:
PRO test_sav
;; this might help you debug it, too:
catch, theError
if theError ne 0 then begin
catch, /CANCEL
void = error_message()
return, 0
endif
cla = command_line_args(count = count)
a = FIX(cla[0])
b = FIX(cla[1])
c = a + b
header = string(c)
file = filepath('test.txt', root_dir='d:')
OpenW, lun3, file, /Get_Lun
PrintF, lun3, header
Free_Lun, lun3
END
|
|
|