📄 fwprintf.html
字号:
<p>The conversion wide-characters and their meanings are:<dl compact><dt>d, i<dd>The <b>int</b> argument is converted to a signed decimalin the style <b>[</b>-<b>]</b><i>dddd</i>.The precision specifies the minimum number of digits to appear;if the value being converted can be represented in fewer digits,it will be expanded with leading zeros. The default precision is1. The result of converting 0 with an explicit precisionof 0 is no wide-characters.<dt>o<dd>The <b>unsigned int</b> argument is converted to unsigned octal formatin the style <i>dddd</i>.The precision specifies the minimum number of digits to appear; ifthe value being converted can be represented in fewer digits, it will beexpanded with leading zeros. The default precision is 1. The result ofconverting 0 with an explicit precision of 0 is no wide-characters.<dt>u<dd>The <b>unsigned int</b> argument is converted to unsigned decimal formatin the style<i>dddd</i>.The precision specifies the minimum number of digits to appear; ifthe value being converted can be represented in fewer digits, it will beexpanded with leading zeros. The default precision is 1. The result ofconverting 0 with an explicit precision of 0 is no wide-characters.<dt>x<dd>The <b>unsigned int</b> argument is converted to unsigned hexadecimal formatin the style<i>dddd</i>;the letters abcdef are used.The precision specifies the minimum number of digits to appear; ifthe value being converted can be represented in fewer digits, it will beexpanded with leading zeros. The default precision is 1. The result ofconverting 0 with an explicit precision of 0 is no wide-characters.<dt>X<dd>Behaves the same as the x conversion wide-character except thatletters ABCDEF are used instead of abcdef.<dt>f<dd>The<b>double</b>argument is converted to decimal notation in the style<b>[</b>-<b>]</b><i>ddd.ddd</i>, where the number of digits after theradix character is equal to the precision specification.If the precision is missing, it is taken as 6; if the precision isexplicitly 0 and no # flag is present, no radix character appears.If a radix character appears, at least one digit appearsbefore it.The value is rounded to the appropriate number of digits.The<i>fwprintf()</i>family of functions may make available wide-character string representations for infinity and NaN.<dt>e, E<dd>The<b>double</b>argument is converted in the style<b>[</b>-<b>]</b><i>d.ddd</i>e<i>±dd</i>,where there is one digit before the radix character(which is non-zero if the argument is non-zero) and the number ofdigits after it is equal to the precision; if the precision ismissing, it is taken as 6; if the precision is 0 and no # flagis present, no radix character appears.The value is rounded to the appropriate number of digits.The E conversion wide-character will produce a number with E instead of e introducing the exponent.The exponent always contains at least two digits.If the value is 0, the exponent is 0.The<i>fwprintf()</i>family of functions may make available wide-character string representations for infinity and NaN.<dt>g, G<dd>The<b>double</b>argument is converted in the style f or e (or in the style Ein the case of a G conversion wide-character),with the precision specifying the number of significant digits.If an explicit precision is 0, it is taken as 1.The style used depends on the value converted; style e (or E)will be used only if the exponent resulting from such aconversion is less than -4 or greater than or equal to theprecision.Trailing zeros are removed from the fractional portion of theresult; a radix character appears only if it is followedby a digit.The<i>fwprintf()</i>family of functions may make available wide-character string representations for infinity and NaN.<dt>c<dd>If no l (ell) qualifier is present, the<b>int</b>argument is converted to a wide-character as if by calling the<i><a href="btowc.html">btowc()</a></i>function and the resulting wide-character is written. Otherwise the<b>wint_t</b>argument is converted to<b>wchar_t</b>,and written.<dt>s<dd>If no l (ell) qualifier is present, the argument must be a pointer to acharacter array containing a character sequence beginning in theinitial shift state.Characters from the array are converted as if by repeated callsto the<i><a href="mbrtowc.html">mbrtowc()</a></i>function, with the conversion state described by an<b>mbstate_t</b>object initialised to zero before the first character isconverted, and written up to (but not including) the terminating null wide-character. If the precision is specified, nomore than that many wide-characters are written.If the precision is not specified or is greater than the size ofthe array, the array must contain a null wide-character.If an l (ell) qualifier is present, the argument must be a pointer to an array of type<b>wchar_t</b>.Wide characters from the array are written up to (but not including) aterminating null wide-character.If no precision is specified or is greater than the size of the array,the array must contain a null wide-character. If a precision isspecified, no more than that many wide-characters are written.<dt>p<dd>The argument must be a pointer to<b>void</b>.The value of the pointer is converted to a sequence of printablewide-characters, in an implementation-dependent manner.<dt>n<dd>The argument must be a pointer to an integer into which is writtenthe number of wide-characters written to the output so far by this call to one of the<i>fwprintf()</i>functions.No argument is converted.<dt>C<dd>Same as <b>lc</b>.<dt>S<dd>Same as <b>ls</b>.<dt>%<dd>Output a % wide-character; no argument is converted.The entire conversion specification must be %%.</dl><p>If a conversion specification does not match one of theabove forms, the behaviour is undefined.<p>In no case does a non-existent or small field widthcause truncation of a field;if the result of a conversion is wider than the field width,the field is simply expanded to contain the conversion result.Characters generated by<i>fwprintf()</i>and<i><a href="wprintf.html">wprintf()</a></i>are printed as if<i><a href="fputwc.html">fputwc()</a></i>had been called.<p>The<i>st_ctime</i>and<i>st_mtime</i>fields of the file will be marked for update between the call toa successful execution of<i>fwprintf()</i>or<i><a href="wprintf.html">wprintf()</a></i>and the next successful completion of a call to<i><a href="fflush.html">fflush()</a></i>or<i><a href="fclose.html">fclose()</a></i>on the same stream or a call to<i><a href="exit.html">exit()</a></i>or<i><a href="abort.html">abort()</a></i>.</blockquote><h4><a name = "tag_000_005_407"> </a>RETURN VALUE</h4><blockquote>Upon successful completion, these functionsreturn the number of wide-characters transmittedexcluding the terminating null wide-character in the case of<i><a href="swprintf.html">swprintf()</a></i>ora negative value if an output error was encountered.If n or more wide characters were requested to be written<i><a href="swprintf.html">swprintf()</a></i>returns a negative value.</blockquote><h4><a name = "tag_000_005_408"> </a>ERRORS</h4><blockquote>For the conditions under which<i>fwprintf()</i>and<i><a href="wprintf.html">wprintf()</a></i>will fail and may fail, refer to<i><a href="fputwc.html">fputwc()</a></i>.<p>In addition, all forms of<i>fwprintf()</i>may fail if:<dl compact><dt>[EILSEQ]<dd>A wide-character code that does not correspond to a valid character has beendetected.<dt>[EINVAL]<dd>There are insufficient arguments.</dl><p>In addition,<i><a href="wprintf.html">wprintf()</a></i>and<i>fwprintf()</i>may fail if:<dl compact><dt>[ENOMEM]<dd>Insufficient storage space is available.</dl></blockquote><h4><a name = "tag_000_005_409"> </a>EXAMPLES</h4><blockquote>To print the language-independent date and time format, thefollowing statement could be used:<pre><code>wprintf (format, weekday, month, day, hour, min);</code></pre>For American usage,<i>format</i>could be a pointer to the wide-character string:<pre><code>L"%s, %s %d, %d:%.2d\n"</code></pre>producing the message:<pre><code>Sunday, July 3, 10:02</code></pre>whereas for German usage,<i>format</i>could be a pointer to the wide-character string:<pre><code>L"%1$s, %3$d. %2$s, %4$d:%5$.2d\n"</code></pre>producing the message:<pre><code>Sonntag, 3. Juli, 10:02</code></pre></blockquote><h4><a name = "tag_000_005_410"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_411"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_005_412"> </a>SEE ALSO</h4><blockquote><i><a href="btowc.html">btowc()</a></i>,<i><a href="fputwc.html">fputwc()</a></i>,<i><a href="fwscanf.html">fwscanf()</a></i>,<i><a href="setlocale.html">setlocale()</a></i>,<i><a href="mbrtowc.html">mbrtowc()</a></i>,<i><a href="stdio.h.html"><stdio.h></a></i>,<i><a href="wchar.h.html"><wchar.h></a></i>,the <b>XBD</b> specification, <a href="../xbd/locale.html"><b>Locale</b> </a>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -