Solved

Stop console from closing

Posted on 2004-09-10
3
760 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
  • 2
3 Comments
 

Accepted Solution

by:
s_senthil_kumar earned 200 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now