Mail Archives: djgpp-workers/1997/09/02/12:18:43
On Tue, 2 Sep 1997, Oberhumer Markus wrote:
> But for some reason Ctrl-Break doesn't work either, so if I
> forget to redirect stdin on the command line I have to reboot !
>
> Am I missing something ?
You forget that signal handling is delayed until your app is back in
protected mode and in its main thread. Since your program is parked
inside a real-mode DOS call (that reads from stdin), you never get to
handle the signal.
That is why any program that could read binary data from stdin, should do
this:
if (!isatty (fileno (stdin)))
setmode (fileno (stdin), O_BINARY);
It doesn't make any sense to switch stdin to binary mode if it is the
console device anyway (can you think of any situation that this is
required?).
- Raw text -