PDA

View Full Version : C???



Jesus Claus
16th February 2004, 07:54
When I compile and run something in C the window just shows up and closes really fast. I have windows xp. Any ideas on how to stop this? Also on my friends computer it dosent close it runs fine on his. Thanks.

baahl
16th February 2004, 08:10
add a break point on the last line of your code, or run it from the command line directly. (start...run...cmd) or add something like sleep(1000*30) right before you return from main.

bobby
18th February 2004, 07:52
Ok a simple answer is, either add a getch() at the end of your code which is included in the conio.h library. If your compiler doesn't support that a more universal way is to make a variable x at the top and have an input of x at the bottom. So it will pause and wait for you to enter a value for x then exit.

Cheetah
19th February 2004, 23:41
goto Start->Run and type 'command'

Then navigate to your folder with the .exe in it and type the exe's file name. This'll run it in this command window and not close.

Shard
20th February 2004, 15:08
But would you really want to do that eveytime you want to load it Cheetah?

Jesus Claus
21st February 2004, 08:12
i just put Sleep(); at the end of my code in one file now it works all the time. without the sleep.

Manpreet
22nd February 2004, 03:55
i had this problem b4 to but i switched to c++

Cheetah
24th February 2004, 00:26
Bah dont use console. Use windows. MFC > all.