|
-
November 10th, 2002, 07:12 PM
#1
Junior Member
How do
How do you tell a program to exit when you press a cetain button in C++
The Many Signatures Of Me[gloworange]Moses Anderson[/gloworange] Moses Anderson [shadow]Moses Anderson[/shadow]
-
November 10th, 2002, 07:47 PM
#2
#include <iostream.h>
main()
{
cout << "Hello World!" << endl;
return 0;
}
or:
cout << “Press ENTER to continue…”;
getch();
return(0);
}
-
November 10th, 2002, 07:51 PM
#3
When you say "button" do you mean "key" or a button as in a graphical interface (meaning you are doing Visual C++ )
Ammo
Credit travels up, blame travels down -- The Boss
-
November 10th, 2002, 08:10 PM
#4
Junior Member
You should implement a kind of "event listener" .. a bit of code which looks after all the events in the sistem and runs continuously with your application, better as a separate thread. Then, when the keyboard is touched on the corresponding key, or the screen button is pressed -as U like- the listener will trigger the program exit (freeing the memory, closing all opened files, eventually closing used network connections, and so on).
Good luck!
Wh .. oops! Let\'s start over!
-
November 10th, 2002, 09:50 PM
#5
BurnByThee, Why the heck did you post the same thread twice only with a different name? You could have and should have atleast given peaple time to post instead of being such a impatiant thread poster.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|