sprintf printing UTF 16 wide string
Hi.
I've done a bit of research and found that I should be able to use '%ls' in a printf format string to print a wide string value. The problem is I only get the first character printed.
My experimental code looks like this:
const wchar_t *pString = L"Ello!";
char buf[100];
sprintf(buf, "String: %ls", pString);
sprintf(buf, "String: %ls", pString);
I have set whar_t to be 16 bit.
I'm using CrossStudio for ARM and the selected processor is LPC1788.
Is my code wrong or do I need to setup something in the project configuration to make it work?
Best regards,
Jan Jørgensen
Please sign in to leave a comment.
Comments
2 comments