Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ scanf.mlx(3W) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

scanf(3S)

stdio(3S)

mbchar(3W)

printf(3W)

vprintf(3W)

widec(3W)

scanf(3W) (MLX Addendum)           (MLX)           scanf(3W) (MLX Addendum)

NAME
     scanf, fscanf, sscanf - convert formatted input (MLX addendum)

SYNOPSIS
     #include <stdio.h>
     #include <widec.h>
     int scanf(const char *format [, pointer] ... );
     int fscanf(FILE *stream, const char *format [, pointer] ... );
     int sscanf(char *s, const char *format [, pointer] ... );

DESCRIPTION
     (International Functions)

     scanf() reads from the standard input stream stdin. fscanf() reads
     from the named input stream. sscanf() reads from the character string
     s. Each function reads characters (bytes), interprets them according
     to a control string format, and stores the results in its arguments.

     The control string usually contains conversion specifications, which
     are used to direct interpretation of input sequences.  The control
     string may contain:

     A.   White-space characters (as defined in isspace() of ctype(3C)).
          Except in two cases described below, these cause input to be read
          up to the next non-white-space character.

     B.   An ordinary character (any EUC character, except the ASCII char-
          acter %), which must match the next byte of the input stream.

     C.   Conversion specifications which direct the conversion of the next
          input field. Only ASCII characters are allowed as conversion
          characters.

     The conversion code indicates the interpretation of the input field,
     and the corresponding pointer argument must match the type being read.
     wc and ws are the conversion specifications for wchart character con-
     trol, they may be used in all three functions.

     wc   A wchart character is expected; the character, which should be
          in EUC, is transformed into a wchart character, and stored in
          the location pointed to by the corresponding argument which
          should be a wchart pointer.  The normal skip over white space is
          suppressed in this case.  To read the next non-space character as
          the wchart character, %1ws should be used. If a field width is
          given, the corresponding argument should refer to a wchart
          array; the indicated number of wchart characters are read.

     ws   A wchart string is expected; characters in EUC are transformed
          into wchart characters and stored in the location pointed to by
          the corresponding argument.  The corresponding argument should be
          a pointer pointing to a wchart array large enough to accept the
          string and a terminating wchart null character, which is added



Page 1                       Reliant UNIX 5.44                      12, 196

scanf(3W) (MLX Addendum)           (MLX)           scanf(3W) (MLX Addendum)

          automatically.  wchart characters are read until the number of
          wchart characters specified in the field width, if supplied, or
          a white-space character is read.

     The conversion performed by these functions terminates at EOF or a
     NULL character in the case of sscanf(), at the end of the control
     string, or when an input character conflicts with the control string.
     In the last case, the offending character is left unread in the input
     stream.

     These functions return the number of successfully matched and assigned
     input items; this number can be zero in the event of an early conflict
     between an input character and the control string. If the input ends
     before the first conflict or conversion, EOF is returned.

WARNING
     A character from a supplementary code set in a scanset enclosed in a
     pair of square brackets is simply interpreted as a byte string. Each
     byte of the input field can match against any byte in the scanset.

NOTES
     These functions can support either typedef unsigned short wchart or
     typedef long wchart conditionally, see mbchar(3W).

SEE ALSO
     scanf(3S), stdio(3S), mbchar(3W), printf(3W), vprintf(3W), widec(3W).




























Page 2                       Reliant UNIX 5.44                      12, 196

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026