prevent exiting

This is a discussion on prevent exiting within the A Brief History of Cprogramming.com forums, part of the Community Boards category; Is there a way to prevent ctrl c from exiting my program?...

  1. #1
    Unregistered
    Guest

    prevent exiting

    Is there a way to prevent ctrl c from exiting my program?

  2. #2
    Registered User cody's Avatar
    Join Date
    Sep 2001
    Posts
    86
    Hi,

    yes, there is a way. You'll have to install your own signal handler by using the signal() function.

    enjoy
    cody
    #include "reallife.h"

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Why?

    Why would you like to do that? If you happen to get into an infinite loop when testing the program, it won't be fun...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    yeah, but if you really do have bulletproof code, that would never happen... plus, if you are coding over a windows environment, you could alt-tab to the rescue... [you'd have to mask those as well... or have a preset PIF disabling those shortcuts...]... if you really want to usurp it, i'd recommend you do it very last...
    hasafraggin shizigishin oppashigger...

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Is there an echo in here..................?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Exiting the program.
    By Taka in forum C Programming
    Replies: 6
    Last Post: 10-14-2007, 10:24 AM
  2. Best way to prevent buffer-overflow
    By Siphon in forum C Programming
    Replies: 1
    Last Post: 01-01-2007, 11:53 AM
  3. How to prevent a function from being overriden?
    By thomas_nibu in forum C++ Programming
    Replies: 18
    Last Post: 11-13-2005, 09:55 PM
  4. prevent char input from int
    By SuperNewbie in forum C Programming
    Replies: 1
    Last Post: 04-08-2004, 03:35 AM
  5. How to prevent exiting from running program
    By scorpio_IITR in forum Linux Programming
    Replies: 5
    Last Post: 01-18-2004, 04:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21