gbuffer_printf()

gbuffer_printf()#

The function gbuffer_printf() appends formatted text to a gbuffer_t * buffer using a printf-style format string and arguments.

Prototype

int gbuffer_printf(
    gbuffer_t *gbuf,
    const char *format,
    ...
);

Parameters

Key

Type

Description

gbuf

gbuffer_t *

Pointer to the gbuffer_t * buffer where the formatted text will be appended.

format

const char *

A printf-style format string specifying how subsequent arguments are formatted.

...

variadic

Additional arguments corresponding to the format specifiers in format.


Return Value

Returns the number of bytes written to the buffer. If an error occurs, it returns 0.

Notes

If the buffer does not have enough space, it attempts to reallocate memory. If reallocation fails, the function logs an error and returns 0.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples