Re: @ Symbol [message #3024] |
Thu, 27 October 1994 09:20 |
sjt
Messages: 72 Registered: November 1993
|
Member |
|
|
mallozzi@ssl.msfc.nasa.gov wrote:
: Hi everyone:
: I would like to include files in my IDL code using the @ symbol, but I
: want to use variable filenames (e.g. @variable_file_name). This is not
: accepted by IDL, so I currently get around it by extending !path to include
: the appropriate directory so IDL finds the file. I have in mind a function
: like INCLUDE, variable_file_name. Has anyone written such a function or know
: of some way to include files by using a variable name?
: Thanks
: mallozzi@ssl.msfc.nasa.gov
I think there could be a problem with this as IDL compiles the routine
into an internal code before executing it, so it would have to be
something like the EXECUTE command. In fact maybe the following would
work (albeit very slowly!)
openr, ilu,/get,file ; Open the file
cline='' ; make the command line a string
while (not eof(ilu)) do begin
readf, ilu, cline
iok = execute(cline)
if (not iok) then message, '++ ERROR in included line: '+cline
endwhile
free_lun, ilu
I'm not sure that this is the best way as I just wrote it on the spur
of the moment.
--
+------------------------+---------------------------------- --+---------+
| James Tappin, | School of Physics & Space Research | O__ |
| sjt@xun8.sr.bham.ac.uk | University of Birmingham | -- \/` |
| "If all else fails--read the instructions!" | |
+----------------------------------------------------------- --+---------+
|
|
|