Files
2025-10-25 03:02:53 +03:00

3.9 KiB
Raw Permalink Blame History

[iostate.flags]

31 Input/output library [input.output]

31.5 Iostreams base classes [iostreams.base]

31.5.4 Class template basic_ios [ios]

31.5.4.4 Flags functions [iostate.flags]

🔗

explicit operator bool() const;

1

#

Returns: !fail().

🔗

bool operator!() const;

2

#

Returns: fail().

🔗

iostate rdstate() const;

3

#

Returns: The error state of the stream buffer.

🔗

void clear(iostate state = goodbit);

4

#

Effects: If ((state | (rdbuf() ? goodbit : badbit)) & exceptions()) == 0, returns.

Otherwise, the function throws an object of classios_base::failure ([ios.failure]), constructed withimplementation-defined argument values.

5

#

Postconditions: Ifrdbuf() != 0 thenstate == rdstate(); otherwiserdstate() == (state | ios_base::badbit).

🔗

void setstate(iostate state);

6

#

Effects: Callsclear(rdstate() | state) (which may throwios_base::failure ([ios.failure])).

🔗

bool good() const;

7

#

Returns: rdstate() == 0.

🔗

bool eof() const;

8

#

Returns: true ifeofbit is set inrdstate().

🔗

bool fail() const;

9

#

Returns: true iffailbit orbadbit is set inrdstate().264

🔗

bool bad() const;

10

#

Returns: true ifbadbit is set inrdstate().

🔗

iostate exceptions() const;

11

#

Returns: A mask that determines what elements set inrdstate() cause exceptions to be thrown.

🔗

void exceptions(iostate except);

12

#

Effects: Callsclear(rdstate()).

13

#

Postconditions: except == exceptions().

264)264)

Checkingbadbit also forfail() is historical practice.