_get_doserrno
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at _get_doserrno.
Gets the error value returned by the operating system before it is translated into an errno
value.
Syntax
errno_t _get_doserrno(
int * pValue
);
Parameters
[out] pValue
A pointer to an integer to be filled with the current value of the _doserrno
global macro.
Return Value
If _get_doserrno
succeeds, it returns zero; if it fails, it returns an error code. If pValue
is NULL
, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, this function sets errno
to EINVAL
and returns EINVAL
.
Remarks
The _doserrno
global macro is set to zero during CRT initialization, before process execution begins. It is set to the operating-system error value returned by any system-level function call that returns an operating-system error, and it is never reset to zero during execution. When you write code to check the error value returned by a function, always clear _doserrno
by using _set_doserrno before the function call. Because another function call may overwrite _doserrno
, check the value by using _get_doserrno
immediately after the function call.
We recommend _get_errno instead of _get_doserrno
for portable error codes.
Possible values of _doserrno
are defined in <errno.h>.
Requirements
Routine | Required header | Optional header |
---|---|---|
_get_doserrno |
<stdlib.h>, <cstdlib> (C++) | <errno.h>, <cerrno> (C++) |
_get_doserrno
is a Microsoft extension. For more compatibility information, see Compatibility.