Thread: Breaking out of a loop with esc key

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    2

    Breaking out of a loop with esc key

    I am writing a datalogger program that uses an infinite loop to log data from the parallel port to a file. I can use Ctrl-C to exit the program but the file handle is not released. Is there a way to use the Esc-key or an F-key to break the loop to close files and end the program systematically?

  2. #2
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    You can free the stuff, just catch SIGTERM (not SIGKILL) then clean up the stuff.

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    2
    I'm a novice. Can you give me an example. My compiler has the signal.h header file. I will be compiling to run this program on a DOS machine.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. loop the loop - feeling foolish
    By estos in forum C Programming
    Replies: 2
    Last Post: 04-07-2007, 02:45 AM
  3. Scope And Parameter Passing
    By djwicks in forum C Programming
    Replies: 6
    Last Post: 03-28-2005, 08:26 PM
  4. heeeeeeellllllpppppppp!!!
    By DarkDays in forum C++ Programming
    Replies: 15
    Last Post: 12-09-2001, 09:43 PM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM