3 ms·
There's also asprintf which is even easier to use (if you don't care about the dynamic allocation).
by cozzyd 8y ago
There's also asprintf which is even easier to use (if you don't care about the dynamic allocation).
- vortico 8y agoIf only this existed in the C standard... You can call snprintf twice, the first time with a NULL buffer and zero-sized length, and the second with a newly allocated buffer with the size equal to the return value of the first snprintf call.