Mail Archives: djgpp/1996/10/27/18:36:23
DJ Delorie wrote:
>
> > All I want to know (having spent hours searching the website) is, how do
> > I trun off the error displays when I quit a program using Ctrl-C or
> > Ctrl-break. I want my program just to end, not to produce an error
> > message or a stack trace. Can that be done?
>
> Try 2.01 instead, I think we addressed that issue for Ctrl-C.
>
> Ctrl-Break will *always* force an "unfriendly" exit. It's there as a
> last resort and debugging aide.
If you really don't want to see those messages, the best way to do it is
to catch SIGINT within your program and have it simply exit. Then you
aren't dependent on any compiler's particular ways. Here's a basic
example that causes the program to simply exit whenever Ctrl-C or
Ctrl-Break is pressed:
#include <signal.h>
void SIGINT_handler( int signal )
{
exit( 255 );
}
int main( void )
{
signal( SIGINT, SIGINT_handler );
...
}
--
John M. Aldrich, aka Fighteer I <fighteer AT cs DOT com>
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS d- s+:- a-->? c++>$ U@>++$ p>+ L>++ E>+ W++ N++ o+ K? w(---) O-
M-- V? PS+ PE Y+ PGP- t+(-) 5- X- R+ tv+() b+++ DI++ D++ G e(*)>++++
h!() !r !y+()
------END GEEK CODE BLOCK------
- Raw text -