Question about if(errno==ERANGE)

The question was asked: 7 years 10 months ago   views: 78
1
Asked: 08-10-2011 в 00:41:20

Answers   1

6

In this case, must be very good to understand the bitwise &.
Let the number of state and consists of N bits. Then this number can carry information about the N errors if the i-th bit in the number is equal to 1-error, 0 - no.
In this case, if state&(constant)!=0, then there was an error.
ios::badbit is a constant responsible for the error as a function of bad
ios::failbit - as does the function fail
In the variable errno is written to the error reading variable. ERANGE error - occurs when we read into a variable a value that does not fit into the variable.
Here is a list of read errors - reference

Answered: 08-10-2011 в 01:04:11
Thank You Leh! - 08-10-2011 в 01:26:43