Closing files if program stopped via CTRL C 
Author Message
 Closing files if program stopped via CTRL C

I have a program that continiously does GETs to a web server and
records data to a file.  To stop it I use Control C to kill the
process.  Is there someway to catch this interrupt and close the file
so that I do not lose any data?

This all takes place on a Redhat 6.2 Linux PC.



Mon, 01 Mar 2004 10:31:45 GMT  
 Closing files if program stopped via CTRL C

Quote:

> I have a program that continiously does GETs to a web server and
> records data to a file.  To stop it I use Control C to kill the
> process.  Is there someway to catch this interrupt and close the file
> so that I do not lose any data?

Use the TclX or Expect signal handlers.  These are usually standard
on Linux installs with tcl, but if you don't have them, you can get
the ActiveTcl installation:
        http://aspn.activestate.com/ASPN/Downloads/ActiveTcl/

--
  Jeff Hobbs                     The Tcl Guy
  Senior Developer               http://www.ActiveState.com/
      Tcl Support and Productivity Solutions



Mon, 01 Mar 2004 12:39:03 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. TSR to stop CTRL-C and CTRL-Break

2. TSR to stop CTRL-C and CTRL-Break

3. How To Stop Program From Closing

4. Ctrl/Y stopped working???

5. Ctrl-C to stop C++ code in python

6. Ctrl-C forwarded to command executed via popen on Unix

7. send CTRL-E via exp_send

8. send Ctrl-X via expect?

9. NT Server not releasing some files on program close

10. Device file not closing on close command

11. closing all files when program terminates

12. Closed file not really closed

 

 
Powered by phpBB® Forum Software