C examples for wchar.h:vswscanf
function
<cwchar> <wchar.h>
Read formatted data from wide string into variable argument list
int vswscanf (const wchar_t* ws, const wchar_t* format, va_list arg);
Parameter | Description |
---|---|
ws | C wide string |
format | a scanf format string |
arg | a variable arguments list |
On success, the function returns the number of items in the argument list successfully filled.
On error, EOF is returned.
#include <stdarg.h> #include <wchar.h> void GetWideMatches ( const wchar_t * str, const wchar_t * format, ... ) { va_list args;/* w w w . jav a 2s . c o m*/ va_start (args, format); vswscanf (str, format, args); va_end (args); } int main () { int val; wchar_t buf[100]; GetWideMatches ( L"99 this is a test", L" %d %ls ", &val, buf); wprintf (L"Product: %ls\nQuantity: %d\n", buf, val); return 0; }