Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.
Moderator: Coders of Rage
Master Jake
Chaos Rift Cool Newbie
Posts: 69 Joined: Sat Dec 12, 2009 8:43 pm
Programming Language of Choice: C/C++
Location: United States
Contact:
Post
by Master Jake » Sat Jan 02, 2010 12:09 pm
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");
}
Ginto8
ES Beta Backer
Posts: 1064 Joined: Tue Jan 06, 2009 4:12 pm
Programming Language of Choice: C/C++, Java
Post
by Ginto8 » Mon Jan 04, 2010 11:12 am
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');
}
Quit procrastinating and make something awesome.
Ducky wrote: Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Master Jake
Chaos Rift Cool Newbie
Posts: 69 Joined: Sat Dec 12, 2009 8:43 pm
Programming Language of Choice: C/C++
Location: United States
Contact:
Post
by Master Jake » Mon Jan 04, 2010 11:52 am
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
eatcomics
ES Beta Backer
Posts: 2528 Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois
Post
by eatcomics » Wed Feb 03, 2010 9:59 pm
Jake go to the Linux side, it's awesome :D