📅  最后修改于: 2020-09-25 09:47:59             🧑  作者: Mango
vwscanf() 函数在
int vwscanf( const wchar_t* format, va_list vlist );
vwscanf() 函数从stdin读取数据,并将值存储到vlist
定义的各个位置。
#include
#include
#include
void read( const wchar_t* format, ... )
{
va_list args;
va_start (args, format);
vwscanf (format, args);
va_end (args);
}
int main ()
{
setlocale(LC_ALL, "en_US.UTF-8");
wchar_t name[50];
wprintf(L"What is your name? ");
read(L" %ls", name);
wprintf(L"Hello %ls\n", name);
return 0;
}
运行该程序时,可能的输出为:
What is your name? Götz
Hello Götz