Input file from which to read data


This attribute specifies the name of a file from which the Channel should read data. If specified it is used in preference to any source function specified when the Channel was created.

Assigning a new value to this attribute will cause any previously opened SourceFile to be closed. The first subsequent call to AST_READ will attempt to open the new file (an error will be reported if the file cannot be opened), and read data from it. All subsequent call to AST_READ will read data from the new file, until the SourceFile attribute is cleared or changed.

Clearing the attribute causes any open SourceFile to be closed. All subsequent data reads will use the source function specified when the Channel was created, or will read from standard input if no source function was specified.

If no value has been assigned to SourceFile, a null string will be returned if an attempt is made to get the attribute value.



In the case of a FitsChan, the specified SourceFile supplements the source function specified when the FitsChan was created, rather than replacing the source function. The source file should be a text file (not a FITS file) containing one header per line. When a value is assigned to SourceFile, the file is opened and read immediately, and all headers read from the file are appended to the end of any header already in the FitsChan. The file is then closed. Clearing the SourceFile attribute has no further effect, other than nullifying the string (i.e. the file name) associated with the attribute.