[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 776
  • Last Modified:

Stop console from closing

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
adecold
Asked:
adecold
  • 2
1 Solution
 
s_senthil_kumarCommented:
#include <conio.h>

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

That should solve your problem.
0
 
adecoldAuthor Commented:
Thanks a lot....
But can you explain to me what theat function actually does.
0
 
s_senthil_kumarCommented:
getch() waits for a character from standard input. So that causes the console to stay until you press a key.
0

Featured Post

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now