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 astChannel:

#include "ast.h"
AstChannel *channel;

...

channel = astChannel( NULL, NULL, "" );

The first two arguments to astChannel specify the external source and sink that the Channel is to use. There arguments are pointers to C functions and we will examine their use in more detail later ([*] and [*]).

In this very simple example we have supplied NULL pointers for both the source and sink functions. 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 211
R.F. Warren-Smith & D.S. Berry
24th May 2011
E-mail:ussc@star.rl.ac.uk

Copyright (C) 2009 Science \& Technology Facilities Council