Archived

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

pause trouble

This topic is 5315 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

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
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