int wscanf(const wchar_t* kwpFormatString, ...);
#include <cwchar>
#include <cstdio>
int main()
{
wchar_t waWideString[21];
wprintf(L"Type in your name and age: ");
// Read in up to 20 characters of a wide string
int iFieldsAssigned = wscanf(L"%20ws", waWideString);
// Empty the input stream for getchar()
fflush(stdin);
wprintf(L"You name is %ws\n", waWideString);
wprintf(L"Assigned fields = %d\n", iFieldsAssigned);
// Keep the window open until "Enter" is pressed
getwchar();
return 0;
}
© 20072025 XoaX.net LLC. All rights reserved.