|
Re: How to parse the output of restore, filename, /ver [message #83837 is a reply to message #83836] |
Fri, 05 April 2013 16:41  |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
On Fri, 5 Apr 2013 16:09:06 -0700 (PDT), Nikola Vitas wrote:
> Hi,
>
> Is there a way to capture the output of
>
> restore, filename, /verb
>
> in a string variable? If yes, is there some standard tool to parse it? For example, I'd like to be able to automatically read which variables are saved in a .sav file.
>
> Thanks!
Hi Nikola,
you can get a list of the contents of a save file before or without
restoring it by the IDL_Savefile object:
obj=obj_new('IDL_Savefile',filename)
contents=obj->Contents()
if contents.n_var ge 1 then print,'Variables: ',obj->Names()
if contents.n_sysvar ge 1 then $
print,'System Variables: ',obj->Names(/system_variable)
; and so on
;
obj_destroy,obj
Cheers, Heinz
|
|
|
|