.\" This manpage is Copyright (C) 2016 MongoDB, Inc. .\" .\" Permission is granted to copy, distribute and/or modify this document .\" under the terms of the GNU Free Documentation License, Version 1.3 .\" or any later version published by the Free Software Foundation; .\" with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. .\" A copy of the license is included in the section entitled "GNU .\" Free Documentation License". .\" .TH "BSON_STRING_T" "3" "2016\(hy10\(hy12" "libbson" .SH NAME bson_string_t \- String Building Abstraction .SH "SYNOPSIS" .nf .nf #include typedef struct { char *str; uint32_t len; uint32_t alloc; } bson_string_t; .fi .fi .SH "DESCRIPTION" .B bson_string_t is an abstraction for building strings. As chunks are added to the string, allocations are performed in powers of two. This API is useful if you need to build UTF\(hy8 encoded strings. .SH "EXAMPLE" .nf .nf bson_string_t *str; str = bson_string_new (NULL); bson_string_append_printf (str, "%d %s %f\en", 0, "some string", 0.123); printf ("%s\en", str\(hy>str); bson_string_free (str, true); .fi .fi .B NOTE .RS You can call .B bson_string_free(3) with .B false if you would like to take ownership of .B str->str . Some APIs that do this might call .B return bson_string_free (str, false); after building the string. .RE .B .SH COLOPHON This page is part of libbson. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.