exit a program

how do i exit a program if the user presses some key(as decided by me,say delete)at any moment of time

Monitor for that key press and then return from the main function
Last edited on
i am using a switch kind of structure in my program..it wont help in my case....i mean it will but i will have to keep checking for this key press...it will make my program very lenghty....isnt there any other alternative
Nope, technically something is ALWAYS checking the keyboard for input as part of what is known as the "Control Loop". It is actually easier to do this with the operating systems API then it is on console.
Topic archived. No new replies allowed.