Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to break out of a FOR loop

Status
Not open for further replies.

goju

Programmer
Sep 25, 2001
6
US
In my Visual C++ program, I click a button with the
mouse and a routine is executed. There is a FOR loop
in this routine which takes 30 seconds or longer to
complete. I would like to have the ability to exit
from this FOR loop before its normal completion by
hitting a key on the keyboard- preferably the "A"
key for abort.
goju
 
include the <conio.h> head file and add the following statement into the for loop:

if (_kbhit() && (_getch() == 'A')) break;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top