If I wanted a program to pause at the completion of a function, and have any key pressed allow the program to continue, what would be the easiest way to do that?
Thanks for the help
DD
Printable View
If I wanted a program to pause at the completion of a function, and have any key pressed allow the program to continue, what would be the easiest way to do that?
Thanks for the help
DD
That's a very common question on the board.
Make sure that you've read the faq or done a board search before you post.
But anyway, there are many ways that one could do it.
Here are a few:
getc() - needs stdio.h
getch() - needs conio.h
getchar() - unsure
you could use this
if <conio.h> is available to you
if notCode:printf("Hit any key to continue");
getch();
Code:printf("Hit any key to continue");
fflush(stdin);
getchar();
>getch();
getch is non-standard, it's best to remain standard whenever possible. If I need a pause then I'll use getchar in stdio.h.
>fflush(stdin);
Perhaps you meant fflush ( stdout ). fflushing input streams is undefined.
-Prelude
Thanks guys,
Got it working, as always I greatly aprecaite the help.
DD