I currently have a running program. All i want to do is be able to shut it down at anypoint by pressing CTRL C. I cannot figure out the code for this command for the life of me. Can someone please help me out? thank you. I am using c++ visual studio 2008
atown282
0
Newbie Poster
Recommended Answers
Jump to PostI don't see anything in your code that would cause Ctrl-C to not deliver a kill signal to the application. Since this is a console application, I assume you are running it in a cmd.exe window?
Jump to PostProblem is your are using
system(pause)
to pause your run. You are waiting at the OS at that point, not your program.C++ has input functions, like
cin
,getline()
, etc that waits better thansystem(pause)
. Use them instead. There is no reason to call the OS to pause any program. …
Jump to PostSo what was the problem? And your solution?
Jump to PostWell that was a way of doing things in UNIX, no need for a down-vote on that but heh, it's your choice.
All 14 Replies
Dudearoo
-3
Junior Poster in Training
atown282
0
Newbie Poster
Dudearoo
-3
Junior Poster in Training
atown282
0
Newbie Poster
Dudearoo
-3
Junior Poster in Training
atown282
0
Newbie Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Lucaci Andrew
140
Za s|n
WaltP
commented:
Since when does Visual Studio C++ work on Linux?
-3
atown282
0
Newbie Poster
atown282
0
Newbie Poster
atown282
0
Newbie Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Lucaci Andrew
140
Za s|n
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.