How do i disable this in VS2005? i really wanna use my own not the default one
This is a discussion on press any key to continue within the C++ Programming forums, part of the General Programming Boards category; How do i disable this in VS2005? i really wanna use my own not the default one...
How do i disable this in VS2005? i really wanna use my own not the default one
Huh?
It's a convenience since console apps are supposed to be run from a command prompt.
Plus I would disagree on using "your own solution."
That "press any key..." message is not there in your final EXE anyway, so what does it matter?
You can also run with debug, and it won't display that message.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
I think the OP wants to use a different message instead of the standard one.
You can't really do that. In standard C++, the best you could get away with would be to print a message with cout or whatever, and then wait for input. Unfortunately, the user would have to hit enter to continue, not just any key, since C++ input is line-buffered.
Also see
http://faq.cprogramming.com/cgi-bin/...&id=1043284385
http://faq.cprogramming.com/cgi-bin/...&id=1043284385
For non-standard solutions, see
http://faq.cprogramming.com/cgi-bin/...&id=1043284392
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
For the heck of it, our own article
http://apps.sourceforge.net/mediawik...=Pause_console
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
You can include <conio.h> in your program. You could then do something like this:
Of course you can use whatever message you want in the cout().Code:cout<<"Press any key to continue"<<endl; _getch();
Conio.h is non-standard, however, and thus should be avoided.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
This "press any key ... " can be inconveniencing. On my console app, i have define a box area where inputs are entered ad out puts are shown. This bl##dy press any key just appears at the wrong places and messes up everything
Then just run in debug-mode and it will never appear.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
It is not part of your application at all - it is part of the runtime environment that MS Visual Studio creates for your application to run in - it adds the "pause" command to the end of your application OUTSIDE of the application. If you run it from a command prompt window, then you won't see it (because it's not there).
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
It will not, simply because command line apps are not supposed to be run from the shell. They are supposed to be run from the cmd, if anything.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
Ok, i've learnt that i could just use getch() instead of system("pause") which causes "press any key ..." .. But both seem not to be a good idea from few ... any ideas as to which function to call instead of the two to pause/halt ?