pmsprintf - Man Page

formatted string conversion

C Synopsis

#include <pcp/pmapi.h>

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

cc ... -lpcp

Description

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.

Diagnostics

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.

See Also

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

Info

PCP Performance Co-Pilot