next up previous
Next: Reading Objects from a Channel
Up: Saving and Restoring Objects (Channels)
Previous: Creating a Channel

Writing Objects to a Channel  

The process of saving Objects is very straightforward. You can simply write any Object to a Channel using the AST_WRITE function, as follows:

      INTEGER NOBJ, OBJECT

      ...

      NOBJ = AST_WRITE( CHANNEL, OBJECT, STATUS )

The effect of this will be to produce a textual description of the Object which will appear, by default, on your program's standard output stream. Any class of Object may be converted into text in this way.

AST_WRITE returns a count of the number of Objects written. Usually, this will be one, unless the Object supplied cannot be represented. With a basic Channel all Objects can be represented, so a value of one will always be returned unless there has been an error. We will see later, however, that more specialised forms of Channel may impose restrictions on the kind of Object you can write ([*]). In such cases, AST_WRITE may return zero to indicate that the Object was not acceptable.



next up previous
Next: Reading Objects from a Channel
Up: Saving and Restoring Objects (Channels)
Previous: Creating a Channel

AST A Library for Handling World Coordinate Systems in Astronomy
Starlink User Note 210
R.F. Warren-Smith & D.S. Berry
30th April 2003
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2003 Central Laboratory of the Research Councils