Each unformatted input function begins execution by constructing
an object of type ios_base::iostate
, termed the local error state, and
initializing it to ios_base::goodbit.
It then creates an object of class
with the default argument
when converted to a value of type
the function endeavors
to obtain the requested input.
Otherwise, if the sentry
constructor exits by throwing an exception or if
object produces false
, when converted to a value of type
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
in the first location of the array.
is set in the local error state and
the input function stops trying to obtain the requested input.
If an exception is thrown during input then
is set in the local error state,
's error state is set to the local error state, and
the exception is rethrown if (exceptions() & badbit) != 0.
If no exception has been thrown it
stores the number of characters extracted
in a member object.
After extraction is done, the input function calls setstate
's error state to the local error state, and
may throw an exception.
In any event the
is destroyed before leaving the unformatted input function.