1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
char *make_message(const char *fmt, ...);
char *one = "this";
char *two = "is";
char *three = "becoming a string";
char *resstr = NULL;
resstr = make_message("%s %s %s", one, two, three);
if(resstr == NULL) {
fprintf(stderr, "Error - make_message(...) == NULL\n");
return;
} else {
size_t origsize = strlen(resstr) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
wchar_t wcstring[newsize];
mbstowcs_s(&convertedChars, wcstring, origsize, resstr, _TRUNCATE);
wcscat_s(wcstring, L" (wchart_t *)");
MessageBox(NULL, wcstring, TEXT("Test MessageBox"), MB_OK);
ads_printf(TEXT("\n%s"), wcstring);
free(resstr);
} |
Partager