Namensräume
Varianten
Aktionen

std::basic_ios::bad

Aus cppreference.com
< cpp‎ | io‎ | basic ios

 
 
Input / Output-Bibliothek
I / O-Manipulatoren
C-style I / O
Puffern
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_streambuf
basic_filebuf
basic_stringbuf
strstreambuf(veraltet)
Streams
Original:
Streams
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Abstraktionen
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ios_base
basic_ios
basic_istream
basic_ostream
basic_iostream
Datei-I / O
Original:
File I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ifstream
basic_ofstream
basic_fstream
String I / O
Original:
String I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_istringstream
basic_ostringstream
basic_stringstream
Array I / O
Original:
Array I/O
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
istrstream(veraltet)
ostrstream(veraltet)
strstream(veraltet)
Types
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
streamoff
streamsize
fpos
Fehler Kategorie Schnittstelle
Original:
Error category interface
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
iostream_category(C++11)
io_errc(C++11)
 
std::basic_ios
Member-Funktionen
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ios::basic_ios
basic_ios::~basic_ios
Funktionen des Staates
Original:
State functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ios::good
basic_ios::eof
basic_ios::fail
basic_ios::bad
basic_ios::operator!
basic_ios::operator bool
basic_ios::rdstate
basic_ios::setstate
basic_ios::clear
Formatierung
Original:
Formatting
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ios::copyfmt
basic_ios::fill
Verschiedenes
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ios::exceptions
basic_ios::imbue
basic_ios::rdbuf
basic_ios::tie
basic_ios::narrow
basic_ios::widen
Geschützt Member-Funktionen
Original:
Protected member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_ios::init
basic_ios::move
basic_ios::swap
basic_ios::set_rdbuf
 
bool bad() const;
Versandkosten true wenn nicht behebbarer Fehler ist auf der zugehörigen Stream aufgetreten. Insbesondere kehrt true wenn badbit in rdstate() gesetzt .
Original:
Returns true if non-recoverable error has occurred on the associated stream. Specifically, returns true if badbit is set in rdstate().
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Die Standard-Bibliothek setzt BadBit in den folgenden Situationen:
Original:
The standard library sets badbit in the following situations:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
  • Einsetzen in den Ausgabe-Stream von put () oder write () aus irgendeinem Grund ausfällt .
    Original:
    Insertion into the output stream by put() or write() fails for any reason.
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Einsetzen in den Ausgabe-Stream von operator <<, std::put_money oder std::put_time, konnte nicht abgeschlossen werden, da das Ende der Ausgabe-Stream erreicht wurde (die Facette der Formatierung ausgegeben Funktion wie num_put::put() oder money_put::put(), liefert einen Iterator iter so dass iter.failed()==true)
    Original:
    Insertion into the output stream by operator <<, std::put_money or std::put_time, could not complete because the end of the output stream was reached (The facet's formatting output function such as num_put::put() or money_put::put(), returns an iterator iter such that iter.failed()==true)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Stream ist mit einem Null-Zeiger für RDBUF () konstruiert oder putback () / unget () wird auf einen Strom mit einer null RDBUF () oder eine Null-Zeiger übergeben operator << (basic_streambuf *) genannt
    Original:
    Stream is constructed with a null pointer for rdbuf(), or putback()/unget() is called on a stream with a null rdbuf(), or a null pointer passed to operator<<(basic_streambuf*)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • RDBUF () -> sputbackc () oder RDBUF () -> sungetc () return Eigenschaften :: eof (), um putback () oder unget ()
    Original:
    rdbuf()->sputbackc() or rdbuf()->sungetc() return traits::eof() to putback() or unget()
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • RDBUF () -> pubsync () gibt -1 zu synchronisieren (), um flush (), oder an den Destruktor ostream :: sentry auf einem unitbuf Stream
    Original:
    rdbuf()->pubsync() returns -1 to sync(), to flush(), or to the destructor of ostream::sentry on a unitbuf stream
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Ausnahme wird während einer I / O-Operation von jedem Mitglied Funktion der zugehörigen Strompuffers geworfen (zB sbumpc (), xsputn (), sgetc (), overflow (), etc)
    Original:
    Exception is thrown during an I/O operation by any member function of the associated stream buffer (e.g. sbumpc(), xsputn(), sgetc(), overflow(), etc)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.
  • Ausnahme ist in iword () oder PWord (geworfen) (zB std :: bad_alloc)
    Original:
    Exception is thrown in iword() or pword() (e.g. std::bad_alloc)
    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Inhaltsverzeichnis

[Bearbeiten] Parameter

(None)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Rückgabewert

true wenn ein nicht behebbarer Fehler aufgetreten ist, false sonst .
Original:
true if a non-recoverable error has occurred, false otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

[edit]
#include <iostream>
#include <fstream>
#include <cstdlib>
int main()
{
    std::ifstream file("test.txt");
    if(!file)  // operator! is used here
    {  
        std::cout << "File opening failed\n";
        return EXIT_FAILURE;
    }
 
    // typical C++ I/O loop uses the return value of the I/O function
    // as the loop controlling condition, operator bool() is used here
    for(int n; file >> n; ) {
       std::cout << n << ' ';
    }
    std::cout << '\n';
 
    if (file.bad())
        std::cout << "I/O error while reading\n";
    else if (file.eof())
        std::cout << "End of file reached successfully\n";
    else if (file.fail())
        std::cout << "Non-integer data encountered\n";
}


[Bearbeiten] Siehe auch

ios_base::iostate flags basic_ios accessors
eofbit failbit badbit good() fail() bad() eof() operator bool() operator!()
false false false true false false false true false
false false true false true true false false true
false true false false true false false false true
false true true false true true false false true
true false false false false false true true false
true false true false true true true false true
true true false false true false true false true
true true true false true true true false true