printmsg(3C)
NAME
printmsg(), fprintmsg(), sprintmsg() − print formatted output with numbered arguments
SYNOPSIS
#include <stdio.h>
int printmsg(const char *format, /* [arg,] */ ...);
int fprintmsg(FILE *stream, const char *format, /* [arg,] */ ...);
int sprintmsg(char *s, const char *format, /* [arg,] */ ...);
DESCRIPTION
printmsg(), fprintmsg(), and sprintmsg() are derived from their counterparts in the printf(3S) manual entry. The conversion character % can be replaced by %digits$. digits are decimal digits representing a number n in the range (1 − {NL_ARGMAX}) (NL_ARGMAX is defined in <limits.h>), and indicates that this conversion should be applied to the nth argument, rather than to the next unused one. All other aspects of formatting are unchanged. All conversion specifications must contain the %digits$ sequence and the user must ensure correct numbering. All parameters must be used exactly once.
EXTERNAL INFLUENCES
Locale
The LC_CTYPE category affects the following features:
• Plain characters within format strings are interpreted as single and/or multi-byte characters.
• Field width is given in terms of bytes. As characters are placed on the output stream, they are interpreted as single or multi-byte characters and the field width is decremented by the length of the character.
• Precision is given in terms of bytes. As characters are placed on the output stream, they are interpreted as single or multi-byte characters and the precision is decremented by the length of the character.
• The return value is given in terms of bytes. As characters are placed on the output stream, they are interpreted as single- or multi-byte characters and the byte count that makes up the return value is incremented by the length of the character.
The LC_NUMERIC category determines the radix character used to print floating-point numbers.
International Code Set Support
Single-byte character code sets are supported. Multi-byte character code sets are also supported as described in the LC_CTYPE category above.
EXAMPLES
To create a language-independent date and time printing routine, use
printmsg(format, weekday, month, day, hour, min);
For American usage format would point to the string:
%1$s, %2$s %3$d, %4$d:%5$.2d
resulting in the output:
Sunday, July 3, 10:02
For German usage, the string:
%1$s, %3$d %2$s %4$d:%5$.2d
results in the following output:
Sonntag, 3 Juli 10:02
provided the proper strings have been read.
WARNINGS
These routines are provided for historical reasons only. Use of the printf(3S) equivalent routines printf, fprintf(), and sprintf() is recommended.
AUTHOR
printmsg() was developed by HP.
SEE ALSO
catgetmsg(3C), setlocale(3C), printf(3S), hpnls(5).
Hewlett-Packard Company — HP-UX Release 9.0: August 1992