Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e7ae7a

Browse files
committed
Fix the _setmode() patch for MS_WINDOWS: include <fcntl.h> and use
fileno(std*).
1 parent e325801 commit 3e7ae7a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

Modules/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ PERFORMANCE OF THIS SOFTWARE.
3737
#include <unistd.h>
3838
#endif
3939

40+
#ifdef MS_WINDOWS
41+
#include <fcntl.h>
42+
#endif
43+
4044
/* Interface to getopt(): */
4145
extern int optind;
4246
extern char *optarg;
@@ -163,8 +167,8 @@ main(argc, argv)
163167

164168
if (unbuffered) {
165169
#ifdef MS_WINDOWS
166-
_setmode(stdin, O_BINARY);
167-
_setmode(stdout, O_BINARY);
170+
_setmode(fileno(stdin), O_BINARY);
171+
_setmode(fileno(stdout), O_BINARY);
168172
#endif
169173
#ifndef MPW
170174
setbuf(stdout, (char *)NULL);

0 commit comments

Comments
 (0)