swscanf - C wchar.h

C examples for wchar.h:swscanf

Type

function

From


<cwchar>
<wchar.h>

Description

Read formatted data from string

Prototype

int swscanf (const wchar_t* ws, const wchar_t* format, ...);

Parameters

Parameter Description
ws C wide string that the function processes as its source to retrieve the data.
format a scanf format string

Return Value

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

On error, EOF is returned.

Demo Code


#include <wchar.h>

int main ()/*from www .  j av  a  2  s .c  o  m*/
{
  wchar_t sentence [] = L"this is a test 10 123";
  wchar_t str [20];
  int i;

  swscanf (sentence,L"%ls %*s %d",str,&i);
  wprintf (L"%ls -> %d\n",str,i);

  return 0;
}

Related Tutorials