Esc menu

I am currently doing a school project. we are allowed to anything as long as it meets the requirements. i have it finished but i want to add something so wherever you are in the code you can press escape and open up a menu that allows you to exit the section of code you are in. is there anyway to do this without pausing the program and asking the user?
This is an extremely complicated thing to do. It may not even be doable in a robust way. You are almost asking for your program to launch itself as its own debugger.

it is not too hard to monitor the keyboard for the escape; a thread can do that, but be sure not to damage the input buffer, only peek at it.

but to stop a 'block of code' mid-stream at any time is nontrivial.
Last edited on
Is there anyway to do this without pausing the program and asking the user?
This suggests what you want is much simpler than what you've asked for.

Your question is a bit underspecified.
Registered users can post here. Sign in or register to post.