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 _set_errno.

Set the value of the errno global variable.

errno_t _set_errno(   
   int value   


[in] value
The new value of errno.

Returns zero if successful.

Possible values are defined in Errno.h. Also, see errno Constants.

// crt_set_errno.c  
#include <stdio.h>  
#include <errno.h>  
int main()  
   _set_errno( EILSEQ );  
   perror( "Oops" );  

Oops: Illegal byte sequence  

RoutineRequired headerOptional header

For more compatibility information, see Compatibility in the Introduction.

errno, _doserrno, _sys_errlist, and _sys_nerr