From: "John M. Aldrich" Newsgroups: comp.os.msdos.djgpp Subject: Re: Turning off stack traces Date: Sun, 27 Oct 1996 10:33:06 -0800 Organization: Three pounds of chaos and a pinch of salt Lines: 41 Message-ID: <3273AAE2.3D2F@cs.com> References: <199610270528 DOT BAA22114 AT delorie DOT com> Reply-To: fighteer AT cs DOT com NNTP-Posting-Host: ppp106.cs.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: jbourqua AT cs DOT mun DOT ca To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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 void SIGINT_handler( int signal ) { exit( 255 ); } int main( void ) { signal( SIGINT, SIGINT_handler ); ... } -- John M. Aldrich, aka Fighteer I -----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------