wscanf -- Read Data Using Wide-Character Format String

Format

#include <wchar.h>
int wscanf(const wchar_t *format,...);

Language Level: ANSI 93
wscanf(format, ... ) is equivalent to fwscanf(stdin, format, ... ).

For a complete description, see fwscanf -- Read Data from Stream Using Wide-Character Format String.

Return Value
If an input failure occurs before any conversion, wscanf returns the value of the macro EOF.

Otherwise, wscanf returns the number of input items assigned, which can be fewer than provided for, or even zero, in the event of an early matching failure.

Example
This example scans various types of data.

#include <stdio.h>
#include <wchar.h>
int main(void)
{
   int i;
   float fp;
   char c,s[81];
   printf("Enter an integer, a real number, a character and a string : \n");
   if (wscanf(L"%d %f %c %s", &i, &fp, &c, s) != 4)
      printf("Not all of the fields were not assigned\n");
   else {
      printf("integer = %d\n", i);
      printf("real number = %f\n", fp);
      printf("character = %c\n", c);
      printf("string = %s\n", s);
   }
   return 0;
   /********************************************************************
      The output should be similar to:
      Enter an integer, a real number, a character and a string :
      12 2.5 a yes
      integer = 12
      real number = 2.500000
      character = a
      string = yes
   ********************************************************************/
}



scanf -- Read Data
fwprintf -- Format Data as Wide Characters and Write to a Stream
swprintf -- Format and Write Wide Characters to Buffer
wprintf -- Format Data as Wide Characters and Print
fwscanf -- Read Data from Stream Using Wide-Character Format String
swscanf -- Read Wide-Character Data from Buffer
<wchar.h>