PMSPRINTF(3) Library Functions Manual PMSPRINTF(3)

pmsprintf - formatted string conversion

#include <pcp/pmapi.h>

int pmsprintf(char *str, size_t size, const char *fmt, ... /*args*/);

cc ... -lpcp

Safe string formatting interface that wraps the vsnprintf(3) call.

It differs primarily in that pmsprintf guarantees that the output buffer str will be null-terminated even when the provided buffer size is insufficient to contain the formatted string. In this case a null-terminated truncated string will be returned in str.

In the case of a failure in the underlying vsnprintf interface, a null-terminated empty string will be returned in str, and the return value will be zero.

On successful completion, pmsprintf returns the number of characters written to the supplied buffer, not including the null terminator.

The return code is always zero or more, never negative.

vsnprintf(3), pmprintf(3) and PMAPI(3).

PCP Performance Co-Pilot