| 1 |
<refentry id="refbufapp"> |
| 2 |
|
| 3 |
<refmeta> |
| 4 |
<refentrytitle>ne_buffer_append</refentrytitle> |
| 5 |
<manvolnum>3</manvolnum> |
| 6 |
</refmeta> |
| 7 |
|
| 8 |
<refnamediv> |
| 9 |
<refname id="ne_buffer_append">ne_buffer_append</refname> |
| 10 |
<refname id="ne_buffer_zappend">ne_buffer_zappend</refname> |
| 11 |
<refname id="ne_buffer_concat">ne_buffer_concat</refname> |
| 12 |
<refpurpose>append data to a string buffer</refpurpose> |
| 13 |
</refnamediv> |
| 14 |
|
| 15 |
<refsynopsisdiv> |
| 16 |
|
| 17 |
<funcsynopsis> |
| 18 |
|
| 19 |
<funcsynopsisinfo>#include <ne_string.h></funcsynopsisinfo> |
| 20 |
|
| 21 |
<funcprototype> |
| 22 |
<funcdef>void <function>ne_buffer_append</function></funcdef> |
| 23 |
<paramdef>ne_buffer *<parameter>buf</parameter></paramdef> |
| 24 |
<paramdef>const char *<parameter>string</parameter></paramdef> |
| 25 |
<paramdef>size_t <parameter>len</parameter></paramdef> |
| 26 |
</funcprototype> |
| 27 |
|
| 28 |
<funcprototype> |
| 29 |
<funcdef>void <function>ne_buffer_zappend</function></funcdef> |
| 30 |
<paramdef>ne_buffer *<parameter>buf</parameter></paramdef> |
| 31 |
<paramdef>const char *<parameter>string</parameter></paramdef> |
| 32 |
</funcprototype> |
| 33 |
|
| 34 |
<funcprototype> |
| 35 |
<funcdef>void <function>ne_buffer_concat</function></funcdef> |
| 36 |
<paramdef>ne_buffer *<parameter>buf</parameter></paramdef> |
| 37 |
<paramdef>const char *<parameter>str</parameter></paramdef> |
| 38 |
<paramdef>...</paramdef> |
| 39 |
</funcprototype> |
| 40 |
|
| 41 |
</funcsynopsis> |
| 42 |
|
| 43 |
</refsynopsisdiv> |
| 44 |
|
| 45 |
<refsect1> |
| 46 |
<title>Description</title> |
| 47 |
|
| 48 |
<para>The <function>ne_buffer_append</function> and |
| 49 |
<function>ne_buffer_zappend</function> functions append a string to |
| 50 |
the end of a buffer; extending the buffer as necessary. The |
| 51 |
<parameter>len</parameter> passed to |
| 52 |
<function>ne_buffer_append</function> specifies the length of the |
| 53 |
string to append; there must be no &nul; terminator in the first |
| 54 |
<parameter>len</parameter> bytes of the string. |
| 55 |
<function>ne_buffer_zappend</function> must be passed a |
| 56 |
&nul;-terminated string.</para> |
| 57 |
|
| 58 |
<para>The <function>ne_buffer_concat</function> function takes |
| 59 |
a variable-length argument list following <parameter>str</parameter>; |
| 60 |
each argument must be a <type>char *</type> pointer to a |
| 61 |
&nul;-terminated string. A &null; pointer must be given as the last |
| 62 |
argument to mark the end of the list. The strings (including |
| 63 |
<parameter>str</parameter>) are appended to the buffer in the order |
| 64 |
given. None of the strings passed to |
| 65 |
<function>ne_buffer_concat</function> are modified.</para> |
| 66 |
|
| 67 |
</refsect1> |
| 68 |
|
| 69 |
<refsect1> |
| 70 |
<title>Examples</title> |
| 71 |
|
| 72 |
<para>The following code will output "<literal>Hello, world. |
| 73 |
And goodbye.</literal>".</para> |
| 74 |
|
| 75 |
<programlisting>ne_buffer *buf = ne_buffer_create(); |
| 76 |
ne_buffer_zappend(buf, "Hello"); |
| 77 |
ne_buffer_concat(buf, ", world. ", "And ", "goodbye.", NULL); |
| 78 |
puts(buf->data); |
| 79 |
ne_buffer_destroy(buf);</programlisting> |
| 80 |
</refsect1> |
| 81 |
|
| 82 |
<refsect1> |
| 83 |
<title>See also</title> |
| 84 |
|
| 85 |
<para><xref linkend="ne_buffer"/>, <xref linkend="ne_buffer_create"/>, |
| 86 |
<xref linkend="ne_buffer_destroy"/></para> |
| 87 |
</refsect1> |
| 88 |
|
| 89 |
</refentry> |