##
Writing Native Objects to a FitsChan

Having created an empty FitsChanFitsChan (§16.3), you can write any AST ObjectObject to it in the native encoding using the astWriteastWrite function. Let us assume we are writing a SkyFrameSkyFrame, as follows:

256#256

Since we have selected the native encoding (§16.1), there are no restrictions on the class of Object we may write, so astWrite should always return a value of one, unless an error occurs. Unlike a basic ChannelChannel (§15.3), this write operation will not produce any output from our program. The FITS headers produced are simply stored inside the FitsChan.

After this write operation, the NcardNcard attribute will be updated to reflect the number of new cards added to the FitsChan and the CardCard attribute will point at the card immediately after the last one written. Since our FitsChan was initially empty, the Card attribute will, in this example, point at the end-of-file (§16.4).

The FITS standard imposes a limit of 68 characters on the length of strings which may be stored in a single header card. Sometimes, a description of an AST Object involves the use of strings which exceed this limit (e.g. a FrameFrame title can be of arbitrary length). If this occurs, the long string will be split over two or more header cards. Each “continuation” card will have the keyword CONTINUE in columns 1 to 8, and will contain a space in column 9 (instead of the usual equals sign). An ampersand (“&”) is appended to the end of each of the strings (except the last one) to indicate that the string is continued on the next card.

Note, this splitting of long strings over several cards only occurs when writing AST Objects to a FitsChan using the astWrite function and the native encoding. If a long string is stored in a FitsChan using (for instance) the astPutFitsastPutFits or astPutCardsastPutCards function, it will simply be truncated.