pause trouble
Well,
[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
[edited by - Lektrix on May 29, 2003 7:00:23 AM]
_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]
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.
Judging from his previous posts and the fact that he mentioned "press any key to continue", I should think he meant Win32 Console Application. If this is the case, the code I suggested in my previous post should work.
[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]
You need to include the standard C input library I believe...
[edited by - YoshiN on May 30, 2003 10:14:27 PM]
#include<cstdio>using namespace std;
[edited by - YoshiN on May 30, 2003 10:14:27 PM]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement