Each unformatted input function begins execution by constructing an object of class
sentry
with the default argument
noskipws
(second) argument
true. If the
sentry
object returns
true,
when converted to a value of type
bool,
the function endeavors
to obtain the requested input
. Otherwise, if the sentry constructor exits by throwing an exception or if
the sentry object returns
false, when converted to a value of type
bool,
the function returns without attempting to obtain any input
. In either case the number of extracted characters is set to 0;
unformatted input functions taking a character array of nonzero size as
an argument shall also store a null character (using
charT())
in the first location of the array
. If an exception is thrown during input then
ios_base::badbit
is turned on
in
*this's
error state
. (Exceptions thrown from
basic_ios<>::clear()
are not caught or rethrown
.)
If
(exceptions()&badbit) != 0
then the exception is rethrown
. It also counts the number of characters extracted
. If no exception has been thrown it ends
by storing the count in a member object
and returning the value specified
. In any event the
sentry
object
is destroyed before leaving the unformatted input function
.