C examples for wchar.h:swprintf
function
<cwchar>
Write formatted data to wide string
int swprintf (wchar_t* ws, size_t len, const wchar_t* format, ...);
Parameter | Description |
---|---|
ws | a buffer to store the resulting C wide string |
len | Maximum number of wide characters to fill |
format | a printf format string |
On success, the total number of characters written is returned.
A negative number is returned on failure.
#include <stdio.h> #include <wchar.h> int main ()//from www. j a va2 s. co m { wchar_t buffer [100]; int cx; cx = swprintf ( buffer, 100, L"this is a test %d and %d %f", 80, 1000 ,123.123); swprintf ( buffer+cx, 100-cx-1, L", and the half of that is %d.", 80/2/2 ); fputws ( buffer, stdout ); return 0; }