Updated: 2022/Sep/29

Please read Privacy Policy. It's for your privacy.

SQLITE3_MPRINTF(3)         Library Functions Manual         SQLITE3_MPRINTF(3)

     sqlite3_mprintf, sqlite3_vmprintf, sqlite3_snprintf, sqlite3_vsnprintf -
     Formatted String Printing Functions

     char *
     sqlite3_mprintf(const char*, ...);

     char *
     sqlite3_vmprintf(const char*, va_list);

     char *
     sqlite3_snprintf(int, char*, const char*, ...);

     char *
     sqlite3_vsnprintf(int, char*, const char*, va_list);

     These routines are work-alikes of the "printf()" family of functions from
     the standard C library.  These routines understand most of the common
     formatting options from the standard library printf() plus some
     additional non-standard formats (%q, %Q, %w, and %z).  See the built-in
     printf() documentation for details.

     The sqlite3_mprintf() and sqlite3_vmprintf() routines write their results
     into memory obtained from sqlite3_malloc64().  The strings returned by
     these two routines should be released by sqlite3_free().  Both routines
     return a NULL pointer if sqlite3_malloc64() is unable to allocate enough
     memory to hold the resulting string.

     The sqlite3_snprintf() routine is similar to "snprintf()" from the
     standard C library.  The result is written into the buffer supplied as
     the second parameter whose size is given by the first parameter.  Note
     that the order of the first two parameters is reversed from snprintf().
     This is an historical accident that cannot be fixed without breaking
     backwards compatibility.  Note also that sqlite3_snprintf() returns a
     pointer to its buffer instead of the number of characters actually
     written into the buffer.  We admit that the number of characters written
     would be a more useful return value but we cannot change the
     implementation of sqlite3_snprintf() now without breaking compatibility.

     As long as the buffer size is greater than zero, sqlite3_snprintf()
     guarantees that the buffer is always zero-terminated.  The first
     parameter "n" is the total size of the buffer, including space for the
     zero terminator.  So the longest string that can be completely written
     will be n-1 characters.

     The sqlite3_vsnprintf() routine is a varargs version of


NetBSD 9.99                    December 19, 2018                   NetBSD 9.99