Re: redirecting output [message #40168 is a reply to message #40163] |
Fri, 16 July 2004 08:02   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
kl_tah@hotmail.com (KL) writes:
> Hi,
> anyone know how I can redirect output from the idl command line to a file?
>
> eg. if idl understood unix style redirect, this might look something like
>
> IDL> print, structure.name > filename
Nigel had a good suggestion.
There's also the good ole' open-print-close approach, as in,
openw, unit, filename, /get_lun
print, unit, structure.name
...
free_lun, unit
Or, you could capture the output in a string and then save it later.
I use this all the time with my PRINTLOG routine,
printlog, log=log, structure.name
printlog, log=log, structure.value, format='(G9.2)'
...
and then you can do anything with the LOG array that you want. It's
just an array of strings, containing a transcript of what you printed
to it.
Good luck,
Craig
P.S. PRINTLOG is at:
http://cow.physics.wisc.edu/~craigm/idl/idl.html
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|