nl_printf.3int
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3INT 代码 · 共 195 行
3INT
195 行
.TH nl_printf 3int.SH Name nl_printf, nl_fprintf, nl_sprintf \- print formatted output.SH Syntax .B #include <stdio.h>.PP.B int nl_printf (.I format[,.I arg] ....B ).br.B char .IR *format ;.PP.B int nl_fprintf (.IR stream , .I format[,.I arg] ....B ).br.B FILE .IR *stream ;.br.B char .IR *format ;.PP.B int nl_sprintf (.IR s , .I format[,.I arg] ....B ).br.B char.IR *s ,.IR format ;.SH Description .NXR "nl_printf subroutine".NXR "nl_fprintf subroutine".NXR "nl_sprintf subroutine"The international functions.PN nl_printf ,.PN nl_fprintf ,and.PN nl_sprintf are identical to and have been superceded by theinternational functions.PN printf ,.PN fprintf ,and.PN sprintf in a library. You should use the .PN printf ,.PN fprintf ,and.PN sprintf functions when you write new calls to print formatted output in an internationalprogram. For more information on these functions, see the .MS printf 3intreference page..PPYou can continue to use existing calls to the .PN nl_printf ,.PN nl_fprintf ,or .PN nl_sprintfinternational functions.These functions remain available for compatibility with XPG\-2conformant software, but may not be supported in future releases of the ULTRIX system..PPThe .PN nl_printf ,.PN nl_fprintf ,and .PN nl_sprintfinternational functions are similar to the .PN printf standard I/O function. (For more information about the.PN printfstandard I/O function, see the .MS printf 3sreference page.)The difference is that the internationalfunctions allow you to use the .I I%digit$ conversion sequence in place of the .I %character you use in the standard I/O functions. The .I digitis a decimal digit.I nfrom 1 to 9. The international functions apply conversions to the.I nth argument in the argument list, rather than to the next unused argument..PPYou can use .I %conversion character in the international functions. However, you cannotmix the .I %conversion character with the.I %digit$conversion sequence in a single call..PPYou can indicate a field width or precision by an asterisk (*), instead of adigit string, in .PN formatstrings containing the.I %conversion character. If you use an asterisk, you can supply aninteger argument that specifies the field width or precision.In .PN format strings containing the.I %digit$conversion character, you can indicate field width or precision by the sequence.I *digit$.You use a decimal digit from 1 to 9 to indicate which argumentcontains an integer that specifies the field width or precision..PPThe conversion characters and their meanings are identical to.PN printf ..PPYou must use each \fIdigit\fR argument at least once.The results of not using an argument are undefined..SS International Environment.IP LC_NUMERIC 15If this environment is set and valid, .PN nl_printfuses the international language database named in the definition todetermine radix character rules..IP LANG 15If this environment variable is set and valid .PN nl_printfuses the international language database named in the definition todetermine collation and character classification rules. If.PN LC_NUMERIC is defined, its definition supercedes the definition ofLANG..SH ExamplesThe following example illustrates using an argument to specify field width:.EX 0nl_printf ("%1$d:%2$.*3$d:%4$.*3$d\\n", hour, min, precision, sec);.EEThe format string .I *3$ indicates that the third argument, whichis named precision, contains the integer field width specification..PPTo print the language independent date and time format, use the following.PN nl_printfstatement:.EXnl_printf (format, weekday, month, day, hour, min);.EEFor United States of America use,.PN formatcould be a pointer to the following string:.EX"%1$s, %2$s %3$d, %4$d:%5$.2d\\n".EEThis .PN format string produces the following message:.EXSunday, July 3, 10:02.EEFor use in a German environment, .PN formatcould be a pointer to the following string:.EX"%1$s, %3$d. %2$s, %4$d:%5$.2d\\n".EEThis.PN formatproduces the following message:.EXSonntag, 3. Juli, 10:02.EE.SH See Also intro(3int), setlocale(3), nl_scanf(3int), printf(3int), scanf(3int), printf(3s), putc(3s), scanf(3s), stdio(3s).br.I Guide to Developing International Software
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?