From: mcastle AT cs DOT umr DOT edu Subject: setmode(fileno(stdin),O_BINARY) prob under dv 2.42 To: djgpp AT sun DOT soe DOT clarkson DOT edu (Djgpp Mailing List) Date: Tue, 5 Jan 93 10:06:57 CST These following programs will both work under dos. The first will work under desqview 2.42 The second will not (locks up, ^c wont work) and have to close the window. test.c: #include #include int main(void) { char line[80]; while ( gets(line) != NULL ) { puts(line); fflush(stdout); } return 0; } test2.c: #include #include int main(void) { char line[80]; setmode(fileno(stdin), O_BINARY); while ( gets(line) != NULL ) { puts(line); fflush(stdout); } return 0; } Well, actually the second will work if you do: go32 a.out < inputfile but without an inputfile, it dies when int 0x21 is called from read() (which gets() calls). Since it works with stdin is being redirected, but not otherwise, I'm wondering if it's a problem with buffering? I didn't *notice* any difference in the flow of the program under debug32 when redirecting stdin and not, but that doesn't mean much. It could be a problem on the turbo-c side. I'm kinda at a loss as to what to do, and since I have neither the source for the libs or go32 on line, I can't do much but report it for now. It's not that big of a problem, just a bit annoying when I have to close a window because I forgot to supply a command line option, or redirect input into a program (such as the fsf ports Eric did). At least it's not locking up the entire machine :-> mrc -- Mike Castle .-=NEXUS=-. Life is like a clock: You can work constantly mcastle AT cs DOT umr DOT edu and be right all the time, or not work at all S087891 AT UMRVMA DOT UMR DOT EDU and be right at least twice a day. -- mrc We are all of us living in the shadow of Manhattan. -- Watchmen