All the functions mentioned in this recipe, and other similar functions that are not discussed here, have multiple overloads grouped in two categories:
- Overloads that take as a last argument a reference to an std::error_code: these overloads do not throw an exception (they are defined with the noexcept specification), but instead set the value of the error_code object to the operating system error code, if an operating system error occurred. If no such error occurred, then the clear() method on the error_code object is called to reset any possible previously set code.
- Overloads that do not take the last argument of the std::error_code type: these overloads throw exceptions if errors occur. If an operating system error occurs, ...