Chapter Contents

Previous

Next
quiet

quiet



Control Library Diagnostic Output

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
EXAMPLE
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

#include <lclib.h>

void quiet(int flag);


DESCRIPTION

quiet suppresses library diagnostics or allows them to be produced. A nonzero argument requests message suppression, and a 0 argument allows diagnostics to be printed (if they have not been suppressed by other active functions).

quiet operates on a function-by-function basis. If any active function calls quiet(1) and does not reset it by calling quiet(0) , diagnostics are suppressed. (Thus, a function cannot countermand a quiet(1) issued by its caller. Also note that quiet(1) has no effect after the function that calls it has terminated.)

You can suppress diagnostics for the entire execution of a program if main issues quiet(1) during start-up. If you want to suppress messages in coprocesses, be sure that the initial main function within each coprocess contains a call to quiet . Calling the quiet function within the main function of a program that subsequently creates coprocesses does not suppress messages within the new coprocess. See Chapter 9, "Coprocessing Functions" in the SAS/C Library Reference, Volume 2 for more information on coprocesses.

If the library option =warning is specified at run time, calls to quiet have no effect. (See Chapter 8, "Run-Time Argument Processing," in the SAS/C Compiler and Library User's Guide for more information about =warning .)


RETURN VALUE

quiet has no return value.


CAUTION

You should use quiet only when a message would be issued by the library for a harmless condition, or in which the caller can generate a more informative message for all possible warning conditions.


EXAMPLE

#include <lclib.h>
#include <stdio.h>

main()
{
   FILE *f;
   quiet(1);                     /* Suppress library messages. */
   f = fopen("ddn:SYSLIN", "r"); /* Try to open SYSLIN.        */
   quiet(0);                     /* Allow messages again,      */
   if (!f){                      /* or use SYSIN as a backup.  */
      puts("Unable to open SYSLIN, using SYSIN instead.");
      f = fopen("ddn:SYSIN", "r");
   }
}


RELATED FUNCTIONS

perror


SEE ALSO


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.