PMSPRINTF

Section: C Library Functions (3)
Index Return to Main Contents

NAME

pmsprintf - 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).


Index

NAME
C SYNOPSIS
DESCRIPTION
DIAGNOSTICS
SEE ALSO