diff options
Diffstat (limited to 'devdocs/c/string%2Fbyte%2Fstrfromf.html')
| -rw-r--r-- | devdocs/c/string%2Fbyte%2Fstrfromf.html | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/devdocs/c/string%2Fbyte%2Fstrfromf.html b/devdocs/c/string%2Fbyte%2Fstrfromf.html new file mode 100644 index 00000000..ce768ba4 --- /dev/null +++ b/devdocs/c/string%2Fbyte%2Fstrfromf.html @@ -0,0 +1,24 @@ + <h1 id="firstHeading" class="firstHeading">strfromf, strfromd, strfromld</h1> <table class="t-dcl-begin"> <tr class="t-dsc-header"> <th> Defined in header <code><stdlib.h></code> </th> <th> </th> <th> </th> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">int strfromf( char *restrict s, size_t n, const char *restrict format, float fp );</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">int strfromd( char *restrict s, size_t n, const char *restrict format, double fp );</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> <tr class="t-dcl t-since-c23"> <td> <pre data-language="c">int strfroml( char *restrict s, size_t n, const char *restrict format, long double fp );</pre> +</td> <td class="t-dcl-nopad"> </td> <td> <span class="t-mark-rev t-since-c23">(since C23)</span> </td> </tr> </table> <p>Converts a floating-point value to a byte string.</p> +<p>The functions are equivalent to <code><a href="http://en.cppreference.com/w/c/io/fprintf"><span class="kw854">snprintf</span></a><span class="br0">(</span>s, n, format, fp<span class="br0">)</span></code>, except that the format string shall only contain the character <span class="sy2">%</span>, an optional precision that does not contain an asterisk <span class="sy2">*</span>, and one of the conversion specifiers <code>a</code>, <code>A</code>, <code>e</code>, <code>E</code>, <code>f</code>, <code>F</code>, <code>g</code>, or <code>G</code>, which applies to the type <code>double</code>, <code>float</code>, or <code>long double</code>) indicated by the function suffix (rather than by a length modifier). Use of these functions with any other format string results in undefined behavior.</p> +<h3 id="Parameters"> Parameters</h3> <table class="t-par-begin"> <tr class="t-par"> <td> s </td> <td> - </td> <td> pointer to a character string to write to </td> +</tr> <tr class="t-par"> <td> n </td> <td> - </td> <td> up to n - 1 characters may be written, plus the null terminator </td> +</tr> <tr class="t-par"> <td> format </td> <td> - </td> <td> pointer to a null-terminated byte string specifying how to interpret the data </td> +</tr> <tr class="t-par"> <td> fp </td> <td> - </td> <td> floating-point value to convert </td> +</tr> +</table> <h3 id="Return_value"> Return value</h3> <p>The number of characters that would have been written had <code>n</code> been sufficiently large, not counting the terminating null character. Thus, the null-terminated output has been completely written if and only if the returned value is both nonnegative and less than <code>n</code>.</p> +<h3 id="Example"> Example</h3> <h3 id="Reference"> Reference</h3> <ul> +<li> C23 standard (ISO/IEC 9899:2023): </li> +<ul><li> 7.24.1.3 The strfromd, strfromf, and strfroml functions </li></ul> +</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td> <div><a href="../../io/fprintf" title="c/io/fprintf"> <span class="t-lines"><span>printf</span><span>fprintf</span><span>sprintf</span><span>snprintf</span><span>printf_s</span><span>fprintf_s</span><span>sprintf_s</span><span>snprintf_s</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> prints formatted output to <code><a href="../../io/std_streams" title="c/io/std streams">stdout</a></code>, a file stream or a buffer <br> <span class="t-mark">(function)</span> </td> +</tr> <tr class="t-dsc"> <td> <div><a href="strtof" title="c/string/byte/strtof"> <span class="t-lines"><span>strtof</span><span>strtod</span><span>strtold</span></span></a></div> +<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span></span></div> </td> <td> converts a byte string to a floating point value <br> <span class="t-mark">(function)</span> </td> +</tr> </table> <div class="_attribution"> + <p class="_attribution-p"> + © cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br> + <a href="https://en.cppreference.com/w/c/string/byte/strfromf" class="_attribution-link">https://en.cppreference.com/w/c/string/byte/strfromf</a> + </p> +</div> |
