📄 fwprintf.html
字号:
<i>wprintf</i>() shall be printed as if <a href="../functions/fputwc.html"><i>fputwc</i>()</a> had been called.</p><p>For <tt>a</tt> and <tt>A</tt> conversions, if FLT_RADIX is not a power of 2 and the result is not exactly representable in thegiven precision, the result should be one of the two adjacent numbers in hexadecimal floating style with the given precision, withthe extra stipulation that the error should have a correct sign for the current rounding direction.</p><p>For <tt>e</tt> , <tt>E</tt> , <tt>f</tt> , <tt>F</tt> , <tt>g</tt> , and <tt>G</tt> conversion specifiers, if the number ofsignificant decimal digits is at most DECIMAL_DIG, then the result should be correctly rounded. If the number of significantdecimal digits is more than DECIMAL_DIG but the source value is exactly representable with DECIMAL_DIG digits, then the resultshould be an exact representation with trailing zeros. Otherwise, the source value is bounded by two adjacent decimal strings<i>L</i> < <i>U</i>, both having DECIMAL_DIG significant digits; the value of the resultant decimal string <i>D</i> shouldsatisfy <i>L</i> <= <i>D</i> <= <i>U</i>, with the extra stipulation that the error should have a correct sign for thecurrent rounding direction.</p><p><sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> The<i>st_ctime</i> and <i>st_mtime</i> fields of the file shall be marked for update between the call to a successful execution of<i>fwprintf</i>() or <i>wprintf</i>() and the next successful completion of a call to <a href="../functions/fflush.html"><i>fflush</i>()</a> or <a href="../functions/fclose.html"><i>fclose</i>()</a> on the same stream, or acall to <a href="../functions/exit.html"><i>exit</i>()</a> or <a href="../functions/abort.html"><i>abort</i>()</a>. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_204_04"></a>RETURN VALUE</h4><blockquote><p>Upon successful completion, these functions shall return the number of wide characters transmitted, excluding the terminatingnull wide character in the case of <i>swprintf</i>(), or a negative value if an output error was encountered, <sup>[<a href="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> and set<i>errno</i> to indicate the error. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p><p>If <i>n</i> or more wide characters were requested to be written, <i>swprintf</i>() shall return a negative value, <sup>[<ahref="javascript:open_code('CX')">CX</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> and set<i>errno</i> to indicate the error. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></blockquote><h4><a name="tag_03_204_05"></a>ERRORS</h4><blockquote><p>For the conditions under which <i>fwprintf</i>() and <i>wprintf</i>() fail and may fail, refer to <a href="fputwc.html"><i>fputwc</i>()</a> .</p><p>In addition, all forms of <i>fwprintf</i>() may fail if:</p><dl compact><dt>[EILSEQ]</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">A wide-character code that does not correspond to a valid character has been detected. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd><dt>[EINVAL]</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">There are insufficient arguments. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl><p>In addition, <i>wprintf</i>() and <i>fwprintf</i>() may fail if:</p><dl compact><dt>[ENOMEM]</dt><dd><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">Insufficient storage space is available. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd></dl></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_03_204_06"></a>EXAMPLES</h4><blockquote><p>To print the language-independent date and time format, the following statement could be used:</p><pre><tt>wprintf(format, weekday, month, day, hour, min);</tt></pre><p>For American usage, <i>format</i> could be a pointer to the wide-character string:</p><pre><tt>L"%s, %s %d, %d:%.2d\n"</tt></pre><p>producing the message:</p><pre><tt>Sunday, July 3, 10:02</tt></pre><p>whereas for German usage, <i>format</i> could be a pointer to the wide-character string:</p><pre><tt>L"%1$s, %3$d. %2$s, %4$d:%5$.2d\n"</tt></pre><p>producing the message:</p><pre><tt>Sonntag, 3. Juli, 10:02</tt></pre></blockquote><h4><a name="tag_03_204_07"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_204_08"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_204_09"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_03_204_10"></a>SEE ALSO</h4><blockquote><p><a href="btowc.html"><i>btowc</i>()</a> , <a href="fputwc.html"><i>fputwc</i>()</a> , <a href="fwscanf.html"><i>fwscanf</i>()</a> , <a href="mbrtowc.html"><i>mbrtowc</i>()</a> , <a href="setlocale.html"><i>setlocale</i>()</a>, the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap07.html">Chapter 7, Locale</a>, <ahref="../basedefs/stdio.h.html"><i><stdio.h></i></a>, <a href="../basedefs/wchar.h.html"><i><wchar.h></i></a></p></blockquote><h4><a name="tag_03_204_11"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 5. Included for alignment with ISO/IEC 9899:1990/Amendment 1:1995 (E).</p></blockquote><h4><a name="tag_03_204_12"></a>Issue 6</h4><blockquote><p>The Open Group Corrigendum U040/1 is applied to the RETURN VALUE section, describing the case if <i>n</i> or more widecharacters are requested to be written using <i>swprintf</i>().</p><p>The DESCRIPTION is updated to avoid use of the term "must" for application requirements.</p><p>The following changes are made for alignment with the ISO/IEC 9899:1999 standard:</p><ul><li><p>The prototypes for <i>fwprintf</i>(), <i>swprintf</i>(), and <i>wprintf</i>() are updated.</p></li><li><p>The DESCRIPTION is updated.</p></li><li><p>The <tt>hh</tt> , <tt>ll</tt> , <tt>j</tt> , <tt>t</tt> , and <tt>z</tt> length modifiers are added.</p></li><li><p>The <tt>a</tt> , <tt>A</tt> , and <tt>F</tt> conversion characters are added.</p></li><li><p>XSI shading is removed from the description of character string representations of infinity and NaN floating-point values.</p></li></ul><p>The DESCRIPTION is updated to use the terms "conversion specifier" and "conversion specification" consistently.</p><p>ISO/IEC 9899:1999 standard, Technical Corrigendum No. 1 is incorporated.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -