next up previous 282
Next: Formatted tokens from Fortran
Up: MSG - Message Reporting System
Previous: Message tokens


Formatted tokens from C

The msgSetx functions encode numeric values in the most concise format that will describe the supplied value. Sometimes, however, a specific format is required; for example, the message may form part of a table. More precise control can be obtained by using the msgFmt function to provide all the standard sprintf() formats available from the standard C library.

      msgFmt( token, format, ... );

and the previous example could be written as:

      msgFmt( "FLUX", "%5.2f", flux );
      msgSetc( "FLUX", funits );
      msgOut( "EXAMPLE_RESULT",
              "Emission flux is ^FLUX", status );

There is no restriction on the number of formats that can be included in a single call so the above example can be simplified further:

      msgFmt( "FLUX", "%5.2f %s", flux, funits );
      msgOut( "EXAMPLE_RESULT",
              "Emission flux is ^FLUX", status );


next up previous 282
Next: Formatted tokens from Fortran
Up: MSG - Message Reporting System
Previous: Message tokens

MERS (MSG and ERR) Message and Error Reporting Systems
Starlink User Note 104
P C T Rees
A J Chipperfield
T Jenness
23 July 2009
E-mail:ussc@star.rl.ac.uk

Copyright © 2009 Science and Technology Facilities Council