Skip to content

Commit e14cbaa

Browse files
authored
Merge pull request MicrosoftDocs#3345 from NikoAri/pr/NikoAri/3343
Add io.h, remove share.h from sample code in errno documentation
2 parents 1eec4d8 + 4b3dcfd commit e14cbaa

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/c-runtime-library/reference/get-errno.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,20 @@ By default, this function's global state is scoped to the application. To change
4141

4242
```C
4343
// crt_get_errno.c
44-
#include <stdio.h>
44+
#include <errno.h>
4545
#include <fcntl.h>
46+
#include <io.h>
47+
#include <stdio.h>
4648
#include <sys/stat.h>
47-
#include <share.h>
48-
#include <errno.h>
4949

5050
int main()
5151
{
5252
errno_t err;
5353
int pfh;
54-
_sopen_s( &pfh, "nonexistent.file", _O_WRONLY, _SH_DENYNO, _S_IWRITE );
55-
_get_errno( &err );
56-
printf( "errno = %d\n", err );
57-
printf( "fyi, ENOENT = %d\n", ENOENT );
54+
_sopen_s(&pfh, "nonexistent.file", _O_WRONLY, _SH_DENYNO, _S_IWRITE);
55+
_get_errno(&err);
56+
printf("errno = %d\n", err);
57+
printf("fyi, ENOENT = %d\n", ENOENT);
5858
}
5959
```
6060

0 commit comments

Comments
 (0)