vswscanf - C wchar.h

C examples for wchar.h:vswscanf

Type

function

From


<cwchar>
<wchar.h>

Description

Read formatted data from wide string into variable argument list

Prototype

int vswscanf (const wchar_t* ws, const wchar_t* format, va_list arg);

Parameters

Parameter Description
ws C wide string
format a scanf format string
arg a variable arguments list

Return Value

On success, the function returns the number of items in the argument list successfully filled.

On error, EOF is returned.

Demo Code


#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;
}

Related Tutorials