To substitute the value of a string into a command line, enclose the name
of the string in braces. As an example, the command RD reads a file from
disk. Its syntax is
To print string variables:
The substitution mechanism can be used to copy the value of a FITS card
into a string. The syntax for this is:
where BUFFER is an arithmetic expression which evaluates to a buffer
number, and CARDNAME is the name of a FITS card.
The value of the FITS card is substituted into the command line where
indicated by the {?BUFFER:CARDNAME} construction. If the buffer number
is incorrect, there is nothing in the listed buffer, or if the named card
does not exist, an error message is printed and a blank string is
loaded. Leading blanks and comments are stripped off. Use the STRING
command to load a string with a FITS character card. Use a direct
assignment to load a numerical FITS card into a VISTA variable. For
example:
<#959#> ADVANCED EXAMPLES:<#959#>
In the examples below, the string substitution is used as part of
procedures. See the section on procedures for more information.
which reads a disk file 'filename' into buffer number 'buf'. Suppose the
string FNAME has been defined to be MYDIR/MYFILE. Then
will execute the command
PRINTF '<#945#>STRING<#945#>'
The <#946#> and <#946#> do the string substitution. The quotes are needed
if the string has more than one word in it.<#978#>
PRINTF 'Writing file
PRINTF 'Writing file
As the procedure is run, the prompt 'Enter ... ' appears user's screen.
The reply is loaded into the string variable FILE. Suppose the reply was
./mydir/hd183143. The next command, which reads an image from the disk,
uses the string substitution mechanism to insert the string FILE into the
command. The actual command executed is
Similarly, the last command in the procedure is
<#981#>
<#982#>
The string substitution mechanism, <#973#> and <#973#>, can also be used to
substitute text from an OPEN'ed file. See the discussion for the OPEN
and READ commands for more details on using text files. <#983#>