A pointer to a read-only wide-character string, where each character is of type `wchar_t`. Used for representing text in wide-character encoding to support extended character sets, such as Unicode. The string is null-terminated, with the terminator being a `wchar_t` with value 0.
1st Parameter
Pointer to a null-terminated wide-character string specifying the format to interpret the input. It may include format specifiers like `%ls`, `%d`, etc.
2nd Parameter Type : ...
Represents a variable number of arguments in a function. Used in functions like `printf` or `fprintf` to accept additional parameters beyond those explicitly declared.
2nd Parameter
Pointers to variables where the parsed input values will be stored. Each pointer corresponds to a format specifier in the `format` string.
Read more about parameters of wscanf in parameters section
The wscanffunction in C language Reads formatted wide character input from the standard input.
wscanf reads data from the standard input (stdin) and stores them according to the parameter format into the locations given by the additional arguments. The format string specifies the admissible input sequences and how they are to be converted for assignment.
The wscanffunction takes 2
parameters:
•
const wchar_t * `format`: Pointer to a null-terminated wide-character string specifying the format to interpret the input. It may include format specifiers like `%ls`, `%d`, etc.
•
... `args`: Pointers to variables where the parsed input values will be stored. Each pointer corresponds to a format specifier in the `format` string.
Reads formatted input from the standard input (`stdin`) based on the format string `format` and stores the extracted values in the provided variables. Returns the number of input items successfully matched and assigned, or `EOF` if an error occurs or the end of input is reached before any matches.
The wscanf function return value :
Returns the number of input items successfully matched and assigned
This can be fewer than provided for, or even zero, in the event of an early matching failure
EOF is returned if the end of input is reached before either the first successful conversion or a matching failure occurs
Output
This example demonstrates the basic usage of wscanf to read an integer and a wide character string from standard input.