Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ sscanf(3W) — DG/UX 5.4R3.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

printf(3W)

vprintf(3W)

widec(3W)

scanf(3S)

stdio(3S)



scanf(3W)                      DG/UX 5.4R3.00                      scanf(3W)


NAME
       scanf, fscanf, sscanf - convert formatted input

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 specification, which
       are used to direct interpretation of input sequences.  The control
       string may contain:

       A.     White-space characters (characters are 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
              character %), 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 new conversion specifications for wchart
       character control, and both 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 automatically.  wchart characters



Licensed material--property of copyright holder(s)                         1




scanf(3W)                      DG/UX 5.4R3.00                      scanf(3W)


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

       The conversion of these functions terminate 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 is compared to the byte in the scanset.

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

































Licensed material--property of copyright holder(s)                         2


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