www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/13/01:35:32

Date: Tue, 13 Aug 1996 08:30:08 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Jens Jedamzik <jedamzik AT eevmic DOT uni-paderborn DOT de>,
Elling Jacobsen <jacobsen AT kjemi DOT unit DOT no>
Cc: djgpp AT delorie DOT com
Subject: Re: interrupting with ctrl-C
In-Reply-To: <4ungbb$bqa@news.uni-paderborn.de>
Message-Id: <Pine.SUN.3.91.960813082640.28748C@is>
Mime-Version: 1.0

On 12 Aug 1996, Jens Jedamzik wrote:

> jacobsen AT kjemi DOT unit DOT no (Elling Jacobsen) wrote:
> > I have a program in which I write data records to a
> > number of files. My problem is that when I interrupt
> > the program using ctrl-C, the files are left empty. I guess
> > the reason is that the data are kept in memory and are
> > not dumped to file at interrupt? Is there any way to
> > ensure that all data records are written to file at
> > interrupt?

You should set up a signal handler for a signal named SIGINT.  Whenever 
Ctrl-C is pressed, that function will be called.  In that function, just 
call `exit'.

For more details about the `signal' function, look up its docs in the 
on-line library reference (libc.inf).

- Raw text -


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