Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
scanf Input Fields
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
An input field is typically delimited by white-space characters
(space, tab, or newline). However, scanf may stop reading a
particular input field before it reaches the white-space character
for a variety of reasons:
■ The specified width has been reached.
■ The next character cannot be converted as specified.
■ The next character conflicts with a character in the control
string that it is supposed to match.
When scanf stops reading an input field, the next input field is
considered to begin at the first unread character.
To read strings not delimited by space characters, a set of
characters in brackets ([ ]) can be substituted for the s (string)
type character. The corresponding input field is read up to the
first character that does not appear in the bracketed character
set. If the first character in the set is a caret (^), the effect
is reversed: the input field is read up to the first character
that does appear in the rest of the character set.
-♦-