Cntrl-C Exit and Error Exits Question

Thomas Dineen tdineen@ix.netcom.com
Tue Jul 11 19:35:00 GMT 2017


Gentle People:

    Some questions on program exits and exit error handlers.

    I am developing a multi-platform application using Gnu/Gcc tools.

    When you Cntrl-C a program is an exit handler of function called?
Is it possible to attach a user supplied Exit Handler to do some
cleanup like close sockets?

     When I Cntrl-C my program it appears the a socket may be left open
causing errors when I restart the program. So I am thinking about exit
handlers to close sockets, close files, and release memory.

      If a program crashes on a common error like divide by zero, or bad
pointer is it possible to add an error handler to catch and process these
errors?

Thomas Dineen







More information about the Gcc-help mailing list