fwscanf.3c (2010 09)

f
fwscanf(3C) fwscanf(3C)
NAME
fwscanf( ), wscanf( ), swscanf( ) - convert formatted wide-character input
SYNOPSIS
#include <stdio.h>
#include <wchar.h>
int fwscanf(FILE *__restrict stream, const wchar_t
*__restrict format, ... );
int wscanf(const wchar_t *__restrict format, ... );
int swscanf(const wchar_t *__restrict s, const wchar_t
*__restrict format, ... );
DESCRIPTION
The fwscanf() function reads from the named input stream.
The
wscanf() function reads from the standard input stream
stdin. The swscanf() reads from the
wide-character string s.
Each function reads wide-characters, interprets them according to a format , and stores the results in its
arguments. Each expects, as arguments, a control wide-character string format described below, and a
set of pointer arguments indicating where the converted input should be stored. The result is undefined
if there are insufficient arguments for the format. If the format is exhausted while arguments remain,
the excess arguments are evaluated but are otherwise ignored.
Conversions can be applied to the nth argument after the format in the argument list, rather than to the
next unused argument. In this case, the conversion wide-character
% (see below) is replaced by the
sequence
%n$, where n is a decimal integer in the range [1,{NL_ARGMAX}]
. This feature provides for
the definition of format wide-character strings that select arguments in an order appropriate to specific
languages. In format wide-character strings containing the
%n$ form of conversion specifications, it is
unspecified whether numbered arguments in the argument list can be referenced from the format wide-
character string more than once.
The format can contain either form of a conversion specification, that is,
% or %
n$, but the two forms
cannot normally be mixed within a single format wide-character string. The only exception to this is that
%% or %* can be mixed with the %n$ form.
The
fwscanf() function in all its forms allows for detection of a language-dependent radix character in
the input string, encoded as a wide-character value. The radix character is defined in the program’s
locale (category LC_NUMERIC). In the POSIX locale, or in a locale where the radix character is not
defined, the radix character defaults to a period (.).
The format is a wide-character string composed of zero or more directives. Each directive is composed of
one of the following:
One or more white-space wide-characters (space, tab, newline, vertical-tab or form-feed charac-
ters);
An ordinary wide-character (neither
% nor a white-space character); or
A conversion specification.
Each conversion specification is introduced by a
% or the sequence %n$ after which the following appear
in sequence:
An optional assignment-suppressing character
*.
An optional non-zero decimal integer that specifies the maximum field width .
An optional size modifier
h, hh, j, l (ell), L, ll (ell-ell), t,orz indicating the size of the receiv-
ing object.
The conversion wide-characters
c, s and [ must be precede by l (ell) if the corresponding
argument is a pointer to wchar_t rather than a pointer to a character type.
The conversion wide-characters
d, i and n must be preceded by h if the corresponding argu-
ment is a pointer to short int rather than a pointer to int, or by hh if it is a pointer to signed
char, or by j if it is a pointer to intmax_t, or by l (ell) if it is a pointer to long int, or by ll
(ell-ell) if it is a pointer to long long, or by t if it is a pointer to ptrdiff_t, or by z if it is a pointer
to ssize_t.
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (6 pages)