Print formatted output to a string, up to a maximum number of
characters
Synopsis:
#include <qdb/qdb.h>
char * qdb_snprintf( int n,
char *buf,
const char *format, ...);
Arguments:
- n
- The maximum number of characters to store in the buffer, including a terminating null character. The function will always
write a zero-terminator if n is positive.
- buf
- A pointer to the buffer where you want the function to store the formatted string.
- format
- A pointer to a formatting string to process. The formatting string determines what additional arguments you need to provide.
For more information, see printf() in the Neutrino Library Reference.
Description:
This function is a variant of the snprintf() from the standard C library. However, it is different from snprintf() in these ways:
- qdb_snprintf() returns a pointer to the buffer rather than the number of characters written
- the order of the n and buf parameters is reversed
- qdb_snprintf() always writes a zero-terminator if n is positive
For more information about additional formatting options, see qdb_mprintf().
CAUTION:
You shouldn't use the return value of this function. In future versions, it may be changed to return the number of characters
written rather than a pointer to the buffer.
Returns:
A pointer to buf, or NULL if an error occurred (errno is set).
Classification:
QNX Neutrino
Safety: |
|
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |