Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
BSON_UINT32_TO_STRING(3)	    libbson	      BSON_UINT32_TO_STRING(3)

SYNOPSIS
	  size_t
	  bson_uint32_to_string	(uint32_t value,
				 const char **strptr,
				 char *str,
				 size_t	size);

PARAMETERS
        value:	A uint32_t.

        strptr: A location for	the resulting string pointer.

        str: A	location to buffer the string.

        size: A size_t	containing the size of str.

DESCRIPTION
       Converts	value to a string.

       If  value  is  from 0 to	999, it	will use a constant string in the data
       section of the library.

       If not, a string	will be	formatted using	str and	snprintf().

       strptr will always be set. It will either point to str  or  a  constant
       string. Use this	as your	key.

ARRAY ELEMENT KEY BUILDING
       Each  element in	a BSON array has a monotonic string key	like "0", "1",
       etc. This function is optimized for generating such string keys.

	  char str[16];
	  const	char *key;
	  uint32_t i;

	  for (i = 0; i	< 10; i++) {
	     bson_uint32_to_string (i, &key, str, sizeof str);
	     printf ("Key: %s\n", key);
	  }

RETURNS
       The number of bytes in the resulting string.

AUTHOR
       MongoDB,	Inc

COPYRIGHT
       2009-present, MongoDB, Inc.

1.30.2				 Apr 12, 2025	      BSON_UINT32_TO_STRING(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=bson_uint32_to_string&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help