Jump to content
  • Advertisement

Archived

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

dchar3

pause trouble

This topic is 5530 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

how do i get a windows application to pause without it saying "press any key to continue"?

Share this post


Link to post
Share on other sites
Advertisement
Well, _getche() will get a character from the console with echo, i.e. if the user presses, for example, 'h', then 'h' will be printed to the screen. If you want to get a character from the console without echo, use _getch() (the no 'e' at the end). Incidently, these functions are defined in conio.h.

#include <iostream>
#include <conio.h>

int main()
{
    ...

    std::cout << "Press any key to exit, Sir ...\n";
    _getch();

    return 0;
}


[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on May 29, 2003 7:00:23 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by dchar3
how do i get a windows application to pause without it saying "press any key to continue"?


Do you mean win32 application that you need to pause automaticly?


use the function

sleep( MS ); where MS is the time to make the application sleep in ms.

Share this post


Link to post
Share on other sites
i tried the _getch() but it said "implicit declaration of function ''int_getch(...)''"

Share this post


Link to post
Share on other sites
You need to include the standard C input library I believe...

#include<cstdio>
using namespace std;


[edited by - YoshiN on May 30, 2003 10:14:27 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by YoshiN
You need to include the standard C input library I believe...


No, getch()/_getch() requires conio.h.

quote:
Original post by Android_s
Umm, what's the difference of _getch() and getch() ?


getch()/_getch() is not part of the ANSI standard, and so it might or might not be supported on every compiler. I believe _getch() does pretty much exactly the same thing as getch(), yet it is just Microsoft's conio.h support. I found, though, that I could use both getch() and _getch() with my Microsoft compiler.

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on May 31, 2003 7:42:33 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!