next up previous 264
Next: Writing Objects to a Channel
Up: Saving and Restoring Objects (Channels)
Previous: The Channel Model


Creating a Channel

The process of creating a Channel is straightforward. As you might expect, it uses the constructor function AST_CHANNEL:

      INCLUDE 'AST_PAR'
      INTEGER CHANNEL, STATUS

      STATUS = 0

      ...

      CHANNEL = AST_CHANNEL( AST_NULL, AST_NULL, ' ', STATUS )

The first two arguments to AST_CHANNEL specify the external source and sink that the Channel is to use. There arguments are the names of Fortran subroutines and we will examine their use in more detail later ([*] and [*]).

In this very simple example we have supplied the name of the null routine AST_NULL22 for both the source and sink routines. This requests the default behaviour, which means that textual input will be read from the program's standard input stream (typically, this means your keyboard) while textual output will go to the standard output stream (typically appearing on your screen). On UNIX systems, of course, either of these streams can easily be redirected to files.


next up previous 264
Next: Writing Objects to a Channel
Up: Saving and Restoring Objects (Channels)
Previous: The Channel Model

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

Copyright (C) 2009 Science \& Technology Facilities Council