94 const char *fmt, va_list ap); |
94 const char *fmt, va_list ap); |
95 ``` |
95 ``` |
96 |
96 |
97 The `cx_sprintf()` and `cx_sprintf_a()` functions take a pointer `str` to a pointer to a pre-allocated buffer, |
97 The `cx_sprintf()` and `cx_sprintf_a()` functions take a pointer `str` to a pointer to a pre-allocated buffer, |
98 as well as a pointer `len` to `*str`'s length. |
98 as well as a pointer `len` to `*str`'s length. |
99 If the formatted output would not fit into this buffer, it is reallocated |
99 If the formatted output does not fit into this buffer, it is reallocated |
100 and the new pointer to the buffer and the new length are written back to the variables pointed to by `str` and `len`. |
100 and the new pointer to the buffer and the new length are written back to the variables pointed to by `str` and `len`. |
101 |
101 |
102 The `cx_sprintf_s()` and `cx_sprintf_sa()` functions differ from the previous function in that they take |
102 The `cx_sprintf_s()` and `cx_sprintf_sa()` functions differ from the previous function in that they take |
103 the pointer to the pre-allocated buffer in the `buf` argument and not in the `str` argument |
103 the pointer to the pre-allocated buffer in the `buf` argument and not in the `str` argument |
104 (which in this case is only used for storing the resulting pointer), and _always_ allocate an entirely new buffer |
104 (which in this case is only used for storing the resulting pointer), and _always_ allocate an entirely new buffer |