delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1997/09/02/12:18:43

Date: Tue, 2 Sep 1997 19:17:02 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Oberhumer Markus <k3040e4 AT c210 DOT edvz DOT uni-linz DOT ac DOT at>
cc: djgpp-workers <djgpp-workers AT delorie DOT com>
Subject: Re: stdin binmode + Ctrl-Break
In-Reply-To: <199709021417.KAA11346@delorie.com>
Message-ID: <Pine.SUN.3.91.970902191318.22592K-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019