Embedded TCP/IP stack
4.7.0
|
fnet_size_t fnet_sprintf | ( | fnet_char_t * | str, |
const fnet_char_t * | format, | ||
... | |||
) |
Print formatted text to the buffer.
str | Pointer to buffer where the resulting string is stored. |
format | Format string. |
The format
string contains the text to be written to the str
buffer. The optional arguments following format
are items (integers, characters or strings) that are to be converted to character strings and inserted into the output of format
at specified placeholders. The number of arguments following the format
parameters should at least be as much as the number of format placeholders.
The syntax for a format placeholder is "%[Flags][Width][Length]Type".
-
: Left justify.+
: Right justify.0
: Pad with leading zeros.h
: Short integer.l
: Long integer.d
, i
: Integer.u
: Unsigned.x
, X
: Hexadecimal.o
: Octal.b
: Binary.p
: Pointer.c
: Single char.s
: Char string.n
: Nothing.The fnet_sprintf() function is just like fnet_printf(), except that the output is sent to buffer.
This function does not check the bounds of the buffer and therefore creates the risk of a buffer overflow. It is recommended to use fnet_snprintf() that doesn't suffer from buffer overruns.