Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Stop console from closing

Posted on 2004-09-10
3
Medium Priority
?
773 Views
Last Modified: 2012-06-27
Hey,
   I just started learning c programming. I started learning with Visual studio.net and ther was an option there that has "start without debugging" under debugging. The thing is i can't use that Visual studio anymore(I'm now trying to use visual studio express 2005 beta 1, or Dev-C++), and other compilers don't have start without debugging...
  So.. now when i run a program straight from windows, the program just runs and the console goes away almost immediately.

QUESTION: is there something i can put in my code that stops the console from closing when the program ends.(or is there something i can do to Visual studio express to allow the console to stay.)

THanks
0
Comment
Question by:adecold
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
s_senthil_kumar earned 800 total points
ID: 12029796
#include <conio.h>

int main()
{
    // Do something
   getch();
}

That should solve your problem.
0
 
LVL 6

Author Comment

by:adecold
ID: 12030923
Thanks a lot....
But can you explain to me what theat function actually does.
0
 

Expert Comment

by:s_senthil_kumar
ID: 12033797
getch() waits for a character from standard input. So that causes the console to stay until you press a key.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question