DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

nl_printf(S)


nl_printf, nl_fprintf, nl_sprintf -- formats native language output

Syntax

cc -a ods30 . . . -lc

int nl_printf (format [, arg...])
char *format;

int nl_fprintf (stream, format [, arg...]) FILE *stream; char *format;

int nl_sprintf (s, format [, arg...]) char *s, *format;

Description

The functions nl_printf, nl_fprintf and nl_sprintf provide same functionality as the standard printf, fprintf and sprintf routines (see printf(S)). They provide an alternative interface to the printf(S) routines for programs written to the X/OPEN Portability Guide, Issue 2, standard. However, nl_printf, nl_fprintf and nl_sprintf have been withdrawn from XPG3.

The conversion character % in the format string is replaced by the sequence %digit$, where digit is a decimal digit n in the range (1-{ NL_ARGMAX }) (see limits(FP)). Conversions are applied to the nth argument in the argument list, rather than to the next unused argument.

The format passed to these functions can contain either form of conversion specification, namely % or %digit$, although the two forms cannot be mixed within a single format string. The format string should contain values for all the arguments specified in the argument list. The asterisk, *, cannot be used to indicate a field width in the format string.

Examples

The following nl_printf statement could be used to print the language independent date and time format:
   nl_printf(format, weekday, month, day, hour, min);
For American usage, format could be a pointer to the string:
   "%1$s, %2$s %3$d, $4$d:%5$.2d\n"
This would produce the following message:
   Sunday, July 3, 10:02
For German usage, format could be a pointer to the string:
   "%1$s, %3$d. %2$s, $4$d:%5$.2d\n"
This would produce the message:
   Sonntag, 3. Juli, 10:02

See also

limits(FP), nl_init(S), nl_scanf(S), printf(S)

Standards conformance

nl_fprintf, nl_printf and nl_sprintf are obsolete and may not be supported on future releases. Use fprintf(S), printf(S) and sprintf(S) instead.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003