Archived

This topic is now archived and is closed to further replies.

Zero Point One

How do I remove the "press any key to continue" when using system("PAUSE")??

Recommended Posts

I''m using Microsoft Visual C++ Basic, and It already implements the system("PAUSE") into it so you don''t have to include it, like some compilers such as Bloodshed DevC++, etc. But I''m writing a program, and if you must know its a text based Rpg for my computer science class, that will require me to pause between character dialogs, but I don''t want it to say "Press any key to continue" after every dialog, I simply want it to pause and then at the hit of enter or another key it continues on. Can I do this with sometype of command that allows the compiler to read a key that has been hit, for example use an empty do loop and the doop loop wont stop untill it has detected a certain key. Is that possible?? Or is there another way.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
"Microsoft Visual C++ Basic" ( ??? )

never heard that before, but you''re programming in C++?

OK, to your question.

You could use a non standart function usually declared in the
non standart header "conio.h" called sonething like getch
( in MS VC++ it is called _getch I think ).

So if you want you''re game to pause.
You could write somthing like this:

// display text on the screen and ...

getch(); // this waits until someone types a character
// and returns teh character read, but this is
// not important for us if we only want to pause

That should work for your case,
I''ve used it often used it that way when I simply wanted to pause
my console progs.

So I hope this works for you to.

Good luck!

Share this post


Link to post
Share on other sites
If you are including the iostream.h header, use cin.get() and pass no values to it. This will read in a keystroke and then throw it away.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Zero Point One
I''m using Microsoft Visual C++ Basic


FOCCLMAO

Share this post


Link to post
Share on other sites
another reason why ppl should learn to pay attentionin class, and learn to read. i dont understand how the heck you would not know about the input functions (which all block) scanf(), cin.get(), getch(), etc. yet know about using system("PAUSE") when it is only useful in batch jobs (you are just running a commndline call). make sure you do have some method of letting the user know to press a key to continue by giving some sort of prompt (otherwise you will really screw up the look of the interface)

Share this post


Link to post
Share on other sites