_vscprintf is not available on Android. Also vsprintf(NULL, fmt, ap) does not work (produces seg fault), so there seems to be no way of calculating size of buffer required for vsnprintf to succeed?
Android sources indicate that __android_log_print function just truncates strings to 1024 using vsnprintf...
How do you handle this scenario?
Section [7.19.6.13]—The vsprintf function—of the C99 Standard does not state that the output buffer may be NULL.
You probably want to use vsnprintf:
int len = vsnprintf(NULL, 0, fmt, ap)
If the call is successful, the return value is the number of characters that would have been written if the buffer were large enough, excluding the NUL terminator. This is like _vscprintf, which also does not include the NUL terminator in its count.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With