📄 glib-string-utility-functions.html
字号:
<div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td><td> a standard <code class="function">printf()</code> format string, but notice <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td><td> the list of arguments to insert in the output.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the number of bytes printed.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id2967207"></a><h3><a name="g-fprintf"></a>g_fprintf ()</h3><a class="indexterm" name="id2967222"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_fprintf (FILE *file, <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> const *format, ...);</pre><p>An implementation of the standard <code class="function">fprintf()</code> function which supports positional parameters, as specified in the Single Unix Specification.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td><td> the stream to write to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td><td> a standard <code class="function">printf()</code> format string, but notice <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td> the arguments to insert in the output.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the number of bytes printed.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id2967358"></a><h3><a name="g-vfprintf"></a>g_vfprintf ()</h3><a class="indexterm" name="id2967373"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_vfprintf (FILE *file, <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> const *format, va_list args);</pre><p>An implementation of the standard <code class="function">fprintf()</code> function which supports positional parameters, as specified in the Single Unix Specification.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>file</code></em> :</span></p></td><td> the stream to write to.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td><td> a standard <code class="function">printf()</code> format string, but notice <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td><td> the list of arguments to insert in the output.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the number of bytes printed.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id2967515"></a><h3><a name="g-sprintf"></a>g_sprintf ()</h3><a class="indexterm" name="id2967530"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_sprintf (<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *string, <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> const *format, ...);</pre><p>An implementation of the standard <code class="function">sprintf()</code> function which supports positional parameters, as specified in the Single Unix Specification.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td><td> A pointer to a memory buffer to contain the resulting string. It is up to the caller to ensure that the allocated buffer is large enough to hold the formatted result</td></tr><tr><td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td><td> a standard <code class="function">printf()</code> format string, but notice <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>...</code></em> :</span></p></td><td> the arguments to insert in the output.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the number of bytes printed.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id2967667"></a><h3><a name="g-vsprintf"></a>g_vsprintf ()</h3><a class="indexterm" name="id2967681"></a><pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gint">gint</a> g_vsprintf (<a class="link" href="glib-Basic-Types.html#gchar">gchar</a> *string, <a class="link" href="glib-Basic-Types.html#gchar">gchar</a> const *format, va_list args);</pre><p>An implementation of the standard <code class="function">vsprintf()</code> function which supports positional parameters, as specified in the Single Unix Specification.</p><p></p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><p><span class="term"><em class="parameter"><code>string</code></em> :</span></p></td><td> the buffer to hold the output.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>format</code></em> :</span></p></td><td> a standard <code class="function">printf()</code> format string, but notice <a class="link" href="glib-String-Utility-Functions.html#string-precision">string precision pitfalls</a>.</td></tr><tr><td><p><span class="term"><em class="parameter"><code>args</code></em> :</span></p></td><td> the list of arguments to insert in the output.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td> the number of bytes printed.</td></tr></tbody></table></div><p class="since">Since 2.2</p></div><hr><div class="refsect2" lang="en"><a name="id2967824"></a><h3><a name="g-snprintf"></a>g_snprintf ()</h3><a class="indexterm" name="id2967836"></a><pre class="programlisting"><a class="link" href="glib-Basic-Typ
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -