Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!goanna!minyos.xx.rmit.oz.au!s892992 From: s892992@minyos.xx.rmit.oz.au (Kendall Bennett) Newsgroups: comp.lang.c++ Subject: Re: How do I call destructors on ^C in TC++? Message-ID: <1991May27.024810.2300@minyos.xx.rmit.oz.au> Date: 27 May 91 02:48:10 GMT References: <1991May24.045847.24401@colorado.edu> Organization: RMIT Computer Centre, Melbourne Australia. Lines: 19 scholes@spot.Colorado.EDU (Genuine Bud Man) writes: > Please excuse me if this is a FAQ, or if I am missing something >painfully obvious, but destructors don't seem to be called when >the user hits ^C in Turbo C++. > I could easily write a ^C handler, and intercept ^C, but how >would the handler know who to call, since the class instances are >auto vars of another function? I could have the handler ignore ^C, >but I would like to have that functionality. I am pretty sure that if you call the exit() standard library function it calls the destructors for any AUTO variables, that is any instances that have been allocated on the stack. If the class instance was allocted in the heap, then it is up to the program to delete it - so I don't know how you would handle this one. See ya, Kendall Bennett (s892992@minyos.xx.rmit.oz.au)