GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::system_error::system_error(3) C++ Standard Libary std::system_error::system_error(3)

std::system_error::system_error - std::system_error::system_error


system_error( std::error_code ec ); (1) (since C++11)
system_error( std::error_code ec, const std::string& what_arg ); (2) (since C++11)
system_error( std::error_code ec, const char* what_arg ); (2) (since C++11)
system_error( int ev, const std::error_category& ecat ); (3) (since C++11)
system_error( int ev, const std::error_category& ecat, (4) (since C++11)
const std::string& what_arg );
system_error( int ev, const std::error_category& ecat, (4) (since C++11)
const char* what_arg );
system_error( const system_error& other ) noexcept; (5) (since C++11)


Constructs new system error object.


1) Constructs with error code ec
2) Constructs with error code ec and explanation string what_arg. The string
returned by what() is guaranteed to contain what_arg as a substring.
3) Constructs with underlying error code ev and associated error category ecat.
4) Constructs with underlying error code ev, associated error category ecat and
explanatory string what_arg. The string returned by what() is guaranteed to contain
what_arg as a substring (assuming that it doesn't contain an embedded null character
).
5) Copy constructor. Initializes the contents with those of other. If *this and
other both have dynamic type std::system_error then std::strcmp(what(),
other.what()) == 0.


ec - error code
ev - underlying error code in the enumeration associated with ecat
ecat - the category of error
what_arg - explanatory string
other - another system_error to copy


Demonstrates how to create a system_error exception from an errno value.

// Run this code


#include <iostream>
#include <system_error>


int main()
{
try
{
throw std::system_error(EDOM, std::generic_category(), "hello world");
}
catch (const std::system_error& ex)
{
std::cout << ex.code() << '\n';
std::cout << ex.code().message() << '\n';
std::cout << ex.what() << '\n';
}
}


generic:33
Numerical argument out of domain
hello world: Numerical argument out of domain

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.