
Originally Posted by
john.c
Why would count magically change to 4? swprintf doesn't modify any parameters except the first. It returns the number of characters written, which would be 3 since it doesn't count the '\0'.
Yeah, sorry.
I thought the count would include the terminating '\0'.
I posted some older code. It looks like this
Code:
#include <stdio.h>
#include <stdint.h>
#include <wchar.h>
#include <string.h>
int main(int argc, char *argv[])
{
int count = 22;
wchar_t data[20];
count = swprintf(data, 20, L"%1s", count);
wprintf(L"string : %s count : %d \n", data, count);
return 0;
}
sprintf does exactly what I want but swprintf doesn't. ^-^