LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-09-2005, 02:42 AM   #1
yogeshm02
Member
 
Registered: Jul 2004
Location: Chandigarh, India
Distribution: SuSe 10.1
Posts: 75

Rep: Reputation: 15
How to tell a C++ programme to quit ?


Hi !
I have written a small C++ programme & am loading it through a init script. I'm using kill to signal it to quit. Is there any better method by which the programme could know this and save its important data.


With regards
 
Old 09-09-2005, 03:45 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
man signal


http://unixhelp.ed.ac.uk/CGI/man-cgi?signal+2

you can't stop the KILL signal.
Use TERM or HUP
 
Old 09-09-2005, 03:46 AM   #3
addy86
Member
 
Registered: Nov 2004
Location: Germany
Distribution: Debian Testing
Posts: 332

Rep: Reputation: 31
You could send a less "devastating" signal to your program which can be cought. Have a look at man 1 kill and man 7 signal.
 
Old 09-09-2005, 05:59 AM   #4
yogeshm02
Member
 
Registered: Jul 2004
Location: Chandigarh, India
Distribution: SuSe 10.1
Posts: 75

Original Poster
Rep: Reputation: 15
Thanks for your reply.

I wanted a way for handling SIGTERM in my C++ prog. Now i know this after i downloaded "Advanced Unix Programming".

Thnaks again for your reply.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems installing and executing programme, lwbeng Linux - Software 5 07-24-2005 08:25 PM
allow ssh then kill the programme master Linux - Security 4 02-06-2005 02:17 AM
Email Registration Programme sathu Programming 2 02-27-2004 05:19 AM
how to access ftp using c++ programme ? mphreddy Programming 1 10-28-2003 03:01 AM
how can I modify this programme? wwnn1 Programming 5 05-14-2002 07:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration