wscanf

wscanf is a standard C library function in C programming language.
It transforms wide character input. This function is supported by the header file wchar.h. wscanf is wide character version of scanf.


Syntax
int wscanf(const wchar_t[1]*input in formatted form)
It returns count of inputs which are properly formatted. Count may be zero or less than the entered inputs in case of unformatted wide character input.


example

# include<stdio.h>

int main()
{
   int   j, result;
   float a;
   char  ch, string[128];
   wchar_t wch, wst[128];
   result = scanf( "%d %f %c %C %80s %80S", &j, &a, &ch, &wch, string, wst );
   printf( "The number of fields input is %d\n", result );
   printf( "The contents are: %d %f %c %C %s %S\n", j, a, ch, wch, string, wst);
   result = wscanf( L"%d %f %hc %lc %80S %80ls", &j, &a, &ch, &wch, string, wst );
   wprintf( L"The number of fields input is %d\n", result );
   wprintf( L"The contents are: %d %f %C %c %hs %s\n", j, a, ch, wch, string, wst);
   return 0;
}


Now if the given input is like as given below: 83 56.6 k m Scanf input
54 22.3 a f Wscanf input


then output will be like this:
The number of fields input is 6
The contents are: 83 56.599998 k m Scanf input
The number of fields input is 6
The contents are: 54 22.300003 a f Wscanf input
Thus scanf returns no of fields which are properly formatted or in another words which are successfully assigned.it does not does not returns the count for the field which is not properly formatted and such values are read but not assigned. And EOF is returned if end of the file character is encountered in first character reading of the file.
Reference