Message "Press any key to continue"

T

Timur Ametov

Hallo everybody.
I'm using Visual Studio 7 and hier is my question. How can i see in
Outputwindow after my Programm ended the message "Press any key to
continue". Is it possible? Now this window will closed automatisch.

Thank you
 
U

utab

Your window will flash some time (and this time period is so short you
wont be able to see the output) in DOS mode and you will have to add
some conio.h functions(getch() before return). But if I am not mistaken
VC++ gives you an option for you to press any key to close that black
DOS mode window so you dont need to do anything special.

This is only a suggestion: If you have the option, try to compile under
linux/Unix using g++ or under windows try programs that emulate UNIX
like environments(like cygwin...)

I do not know if I got your question right.

Regards
 
T

Timur Ametov

But if I am not mistaken
VC++ gives you an option for you to press any key to close that black
DOS mode window so you dont need to do anything special.

That is the problem. I don't know, how or where can I enable this option.
The help is written part in english, part in german, so that to search the
answer there is a bad idea :(
 
M

Marcus Kwok

Please do not top post, and do not trim attribution lines (added back
in).

Kyle Small said:
system("pause");

This is not portable. If the OP can relax his restriction to the
<Enter> key instead of any key, then a portable way to do this is
something like:

std::cout << "Press <Enter> to continue\n";
std::string trash;
std::getline(std::cin, trash);
 
S

stefan.ciobaca

I believe the Press any key message appears automagically in Visual C++
when running one of the Debug or Release builds, not sure exactly which
one (it's the one you're not currently using)./
 
T

Timur Ametov

I believe the Press any key message appears automagically in Visual C++
when running one of the Debug or Release builds, not sure exactly which
one (it's the one you're not currently using)./

I also believed that, but it is not so and i don't know where can i enable
this feature.

Tim
 
D

Default User

Timur said:
I also believed that, but it is not so and i don't know where can i
enable this feature.

OT, but my version of VSC++6 certainly does that.

If you have trouble setting up your IDE, you need to go to a newsgroup
dedicated to it. This is not the place to discuss your implementation.

If you want a platform-independent method, request the users to HIT CR
TO CONTINUE and use some sort of read from standard in to consume all
input up to the new-line.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top