A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/cpp_standard_library/cpp_ios_bad.htm below:

C++ IOS Library - bad

C++ IOS Library - bad Description

It is used to check whether badbit is set. This flag is set by operations performed on the stream when an error occurs while read or writing data, generally causing the loss of integrity of the stream.

Notice that this function is not the exact opposite of good, which checks whether none of the error flags (eofbit, failbit and badbit) are set, and not only badbit −

iostate value(member constants) indicates functions to check state flags good() eof() fail() bad() rdstate() goodbit No errors (zero value iostate) true false false false goodbit eofbit End-of-File reached on input operation false true false false eofbit failbit Logical error on i/o operation false false true false failbit badbit Read/writing error on i/o operation false false true true badbit Declaration

Following is the declaration for ios::bad function.

bool bad() const;
Parameters

none

Return Value

True if the stream's badbit error state flag is set or else false.

Exceptions

Strong guarantee − if an exception is thrown, there are no changes in the stream.

Data Races

Accesses the stream object.

Concurrent access to the same stream object may cause data races.

ios.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4