Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


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


Required header

Optional header




For more compatibility information, see Compatibility in the Introduction.

© 2015 Microsoft