
- The C Standard Library
- The C Standard Library
- The C++ Standard Library
- C++ Library - Home
- C++ Library - <fstream>
- C++ Library - <iomanip>
- C++ Library - <ios>
- C++ Library - <iosfwd>
- C++ Library - <iostream>
- C++ Library - <istream>
- C++ Library - <ostream>
- C++ Library - <sstream>
- C++ Library - <streambuf>
- C++ Library - <atomic>
- C++ Library - <complex>
- C++ Library - <exception>
- C++ Library - <functional>
- C++ Library - <limits>
- C++ Library - <locale>
- C++ Library - <memory>
- C++ Library - <new>
- C++ Library - <numeric>
- C++ Library - <regex>
- C++ Library - <stdexcept>
- C++ Library - <string>
- C++ Library - <thread>
- C++ Library - <tuple>
- C++ Library - <typeinfo>
- C++ Library - <utility>
- C++ Library - <valarray>
- The C++ STL Library
- C++ Library - <array>
- C++ Library - <bitset>
- C++ Library - <deque>
- C++ Library - <forward_list>
- C++ Library - <list>
- C++ Library - <map>
- C++ Library - <queue>
- C++ Library - <set>
- C++ Library - <stack>
- C++ Library - <unordered_map>
- C++ Library - <unordered_set>
- C++ Library - <vector>
- C++ Library - <algorithm>
- C++ Library - <iterator>
- C++ Programming Resources
- C++ Programming Tutorial
- C++ Useful Resources
- C++ Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C++ IOS Library - Errc
Description
This enum class type defines the error conditions of the iostream category. The enum includes at least the following label as shown −
io_errc label | value | description |
---|---|---|
stream | 1 |
Error in stream |
All library implementations define at least this value (stream, with a value of 1), but may provide additional values, especially if they require to produce additional error codes for the iostream category.
Values of the enum type io_errc may be used to create error_condition objects to be compared against the value returned by the code member of ios_base::failure.
Declaration
Following is the declaration for std::io_errc function.
enum class io_errc;;
Parameters
none
Example
In below example explains about std::io_errc function.
#include <iostream> int main () { std::cin.exceptions (std::ios::failbit|std::ios::badbit); try { std::cin.rdbuf(nullptr); } catch (std::ios::failure& e) { std::cerr << "failure caught: "; if ( e.code() == std::make_error_condition(std::io_errc::stream) ) std::cerr << "stream error condition\n"; else std::cerr << "some other error condition\n"; } return 0; }
Let us compile and run the above program, this will produce the following result −
failure caught: stream error condition
ios.htm
Advertisements