swprintf

127 views
Skip to first unread message

zzeng

unread,
Dec 2, 2009, 6:12:43 AM12/2/09
to android-ndk
Hi all,
I am porting some geo-database application and it looks like there is
a prooblem with swprintf call in NDK 1.6:
...
#define ITF_LOG L"LOG"
wchar_t wbuf[64]=L"1234567890";
swprintf (wbuf, 64, L"<%ls>", ITF_LOG);
char buf[64]="2231324";
for (int i = 0; i < 64; i++)
buf[i] = (char)wbuf[i];

__android_log_print(ANDROID_LOG_DEBUG, "mapView", "Hi! A'm in
init_logs '%s'\n", &buf[0]);
...
The result is:

12-02 16:44:29.149: DEBUG/mapView(1384): Hi! A'm in init_logs
'<234567890'
In case of ''%s" format string the result is the same.

May anyone clarify this?
Thanks, Boris

David Turner

unread,
Dec 2, 2009, 7:26:34 PM12/2/09
to andro...@googlegroups.com
wchar_t is not supported in Android, forget about it, really.


--

You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.



zzeng

unread,
Dec 3, 2009, 8:30:04 AM12/3/09
to android-ndk
Oops, even 'wcslen' :)
Well, will do it myself.

Tobias Lindberg

unread,
Dec 4, 2009, 3:48:06 AM12/4/09
to andro...@googlegroups.com
Hey if you just wanna do a printf function this is how I did it:

in my mk-file i wrote the following line but you should check the path so it fits with your ndk:

LOCAL_LDLIBS := -Lbuild/platforms/android-4/arch-arm/usr/lib -llog

in my c-code I wrote this:

#include <android/log.h>

#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG  , "libnav",__VA_ARGS__)

I hope this is what you wanted,
best regards,
Tobias Lindberg

2009/12/3 zzeng <zz...@mail.ru>
Oops, even 'wcslen' :)
Well, will do it myself.
Reply all
Reply to author
Forward
0 new messages