I built a simple method like below
wchar_t buf[1024] = {};
void logDebugInfo(wchar_t* fmt, ...)
{
va_list args;
va_start(args, fmt);
vswprintf(
This is a bit old, but I've hit this while searching for a solution.
It seems that the NDK (r8d for me) is still not supporting wsprintf:
see issue
and code.
In my case I am using libjson (considering switching to yajl) for iOS/Android shared native code.
Until I'll switch libraries, my workaround for NDK is this:
double value = 0.5; // for example
std::wstringstream wss;
wss << value;
return json_string(wss.str());
I've read that streams are slower than the C functions, and if you need a pure C (and not C++) solution it doesn't help, but maybe someone will find this useful.