Page 1 of 1

Press Enter To Continue

Posted: Sat Jan 02, 2010 12:09 pm
by Master Jake
This function is very simple, but it can come in handy when making text-based rpg's. Unlike most "wait" functions, it does not display the characters entered and only accepts the enter (carriage return) to continue.

Required Libraries
stdio.h
conio.h

Code: Select all

void Wait()
{
	printf("\nPress <ENTER> To Continue . . .");

	char kbInput;
	
	do
		kbInput = _getch();

	while ((int) kbInput != 13);

	printf("\n");
}

Re: Press Enter To Continue

Posted: Mon Jan 04, 2010 11:12 am
by Ginto8
Here's a simple, easier method in C/++ using stdio.h/cstdio that is not Windows-dependent (getch() and other conio.h functions are Windows-only). ;)

Code: Select all

void Wait()
{
    printf("\nPress <ENTER> To Continue . . .");
    while(getchar()!='\n');
    putchar('\n');
}

Re: Press Enter To Continue

Posted: Mon Jan 04, 2010 11:52 am
by Master Jake
Nice =)

But the whole point of the above one was
it does not display the characters entered
As for Windows only, I'm still stuck in that world :(

Re: Press Enter To Continue

Posted: Wed Feb 03, 2010 9:59 pm
by eatcomics
Jake go to the Linux side, it's awesome :D