GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
BSON_STRING_T(3) libbson BSON_STRING_T(3)

WARNING:

Deprecated since version 1.29.0.



String Building Abstraction

#include <bson/bson.h>
typedef struct {

char *str;
uint32_t len;
uint32_t alloc; } bson_string_t;


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-8 encoded strings.

bson_string_t *str;
str = bson_string_new (NULL);
bson_string_append_printf (str, "%d %s %f\n", 0, "some string", 0.123);
printf ("%s\n", str->str);
bson_string_free (str, true);


TIP:

You can call bson_string_free() with false if you would like to take ownership of str->str. Some APIs that do this might call return bson_string_free (str, false); after building the string.


MongoDB, Inc

2009-present, MongoDB, Inc.

July 3, 2025 1.30.4

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.