vfwscanf(), vwscanf(), vswscanf() — Wide-character formatted input of a STDARG argument list

Standards

Standards / Extensions C or C++ Dependencies

C99
Single UNIX Specification, Version 3
Language Environment
C++ TR1 C99

both z/OS® V1R7

Format

#define _ISOC99_SOURCE
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>

int vfwscanf(FILE *__restrict__ stream, 
             const wchar_t *__restrict__ format, va_list arg);

int vwscanf(const wchar_t *__restrict__ format, va_list arg);

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

#define _OPEN_SYS_UNLOCKED_EXT 1
#include <wchar.h>

int vfwscanf_unlocked(FILE *__restrict__ stream, 
             const wchar_t *__restrict__ format, va_list arg);
int vwscanf_unlocked(const wchar_t *__restrict__ ws, 
             const wchar_t *__restrict__ format, va_list arg);

General description

The vfwscanf(), vswscanf(), and vwscanf() functions are equivalent to the fwscanf(), swscanf(), and wscanf() functions, respectively, except that instead of being called with a variable number of arguments, they are called with an argument list as defined in stdarg.h.

The argument list should be initialized using the va_start macro before each call. These functions do not invoke the va_end macro, but instead invoke the va_arg macro causing the value of arg after the return to be unspecified.

vfwscanf() and vwscanf() are not supported for files opened with a record type. They also have the same restrictions as a write immediately following a read or a read immediately following a write. This is because, between a write and a subsequent read, there must be an intervening flush or reposition and between a read and a subsequent write, there must also be an intervening flush or reposition unless EOF has been reached.

Note: In contrast to some UNIX-based implementations of the C language, the z/OS XL C/C++ implementation of the vwscanf() family increments the pointer to the variable arguments list. To control whether the pointer is incremented, call the va_end macro after each function call.

vfwscanf_unlocked() and vwscanf_unlocked() are functionally equivalent to vfwscanf() and vwscanf() with the exception that they are not thread-safe. These functions may safely be used in a multithreaded application if and only if they are called while the invoking thread owns the (FILE*) object, as is the case after a successful call to either the flockfile() or ftrylockfile() function.

Returned value

Refer to fwscanf().

Related information