Espaços nominais
Variantes
Acções

std::ios_base::failure

Da cppreference.com
< cpp‎ | io‎ | ios base

 
 
De entrada / saída da biblioteca
I / O manipuladores
C estilo de I / O
Buffers
Original:
Buffers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(obsoleta)
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.
Abstrações
Original:
Abstractions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
File 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.
Cordas 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.
Matriz de 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.
(obsoleta)
(obsoleta)
(obsoleta)
Tipos
Original:
Types
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Interface de categoria de erro
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.
(C++11)
 
ios_base::failure
Funções de membro
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.
failure::failure
 
Definido no cabeçalho <ios>
class failure;
O std::ios_base::failure classe define um objeto de exceção que é acionada em caso de falha as funções na entrada / saída da biblioteca.
Original:
The class std::ios_base::failure defines an exception object that is thrown on failure by the functions in the Input/Output library.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
cpp/error/exceptionstd-ios base-failure-2003-inheritance.svg
Sobre esta imagem

Inheritance diagram (até C++11)

cpp/error/exceptioncpp/error/runtime errorcpp/error/system errorstd-ios base-failure-inheritance.svg
Sobre esta imagem

Inheritance diagram (desde C++11)

Índice

[editar]Funções de membro

constrói o objeto de exceção
Original:
constructs the exception object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função pública membro)[edit]

Herdado de std::system_error

Member functions

retorna código de erro
Original:
returns error code
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::system_error função pública membro)[edit]
[virtual]
Retorna a string explicativo
Original:
returns explanatory string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::system_error função pública virtual membro)[edit]

Herdado de std::exception

Member functions

[virtual]
destrói o objeto de exceção
Original:
destructs the exception object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::exception função pública virtual membro)[edit]
[virtual]
retorna uma cadeia explicativa
Original:
returns an explanatory string
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::exception função pública virtual membro)[edit]

[editar]Exemplo

#include <iostream>#include <fstream>int main(){std::ifstream f("doesn't exist");try{ f.exceptions(f.failbit);}catch(const std::ios_base::failure& e){std::cout<<"Caught an ios_base::failure.\n"<<"Explanatory string: "<< e.what()<<'\n'<<"Error code: "<< e.code()<<'\n';}}

Saída:

Caught an ios_base::failure. Explanatory string: ios_base::clear: unspecified iostream_category error Error code: iostream:1

[editar]Veja também

(C++11)
O erro de IO códigos de fluxo
Original:
the IO stream error codes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(enum)[edit]
close