next up previous 282
Next: Including escape characters in messages
Up: MSG - Message Reporting System
Previous: Formatted tokens from Fortran


Direct formatted message output with msgOut

The C interface provides variants to the standard msgOut and msgOutif functions that can handle sprintf() style format strings. This can lead to a significant reduction in the number of lines spent setting up tokens by embedding the formatting directly in the required string. The example from the previous section can simply be written as:

      msgOutf( "EXAMPLE_RESULT",
              "Emission flux is %5.2f %s", status, flux, funits );

msgOutf and msgOutiff act like printf() whereas msgOutifv is a variant of msgOutif that takes a va_list argument rather than variadic ''$\ldots$'' arguments. The ``%'' character is special in this context and the ADAM definition is not available. A literal ``%'' is obtained by doubling up the symbol (``%%'') as would be used in printf() and described in the next section.


next up previous 282
Next: Including escape characters in messages
Up: MSG - Message Reporting System
Previous: Formatted tokens from Fortran

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