//  Copyright 2006 Hewlett-Packard Development Company, L.P.
//
//  An example of calling $fao for formatted ASCII output, and 
//  lib$put_output
//
#include <descrip.h>
#include <lib$routines.h>
#include <ssdef.h>
#include <starlet.h>
#include <stsdef.h>
main()
    {
    int retstat;
    short outlen;
    $DESCRIPTOR(c, "!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB,!SB" );
    struct dsc$descriptor out = { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0 };

#define OUTSIZ 20480
    out.dsc$w_length = 20480;
    out.dsc$a_pointer = malloc( OUTSIZ );

    retstat = sys$fao( &c, &outlen, &out, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25 );
    if ( !$VMS_STATUS_SUCCESS( retstat ))
	return retstat;

    if ( out.dsc$b_class == DSC$K_CLASS_S )
	out.dsc$w_length = outlen;

    lib$put_output( &out );

    return SS$_NORMAL;
    }
