-
Programming C Question
Hi all,
This is the only part of the forum where I thought my question would fit in. I am new to programming in C and c++. Everytime I go to run my programs in windows xp they open and close out really fast. The only way I could stop that was by adding a pause in there and adding a pause to every one of my programs gets really tedious (at least to me it does) Is there any command in ms-dos that could keep open my program without windows xp closing it so fast. Its just frustrating not being able to see the output of the program.
Thanks for your help
RiVa
-
bacause, there is no pause at the end of your program...
either stick an inkey type statement at the end, or you can set windows to not close DOS program's after their done...
[edit]
You can use getc() or getchar() from stdio.h
You can also have a delay instead Sleep(milliseconds);
You can also run the exe from the prompt and it will not close the window
[/edit]
-
TampaBay give a great suggestion you can also open a console window (start-run-cmd) and go to the directory where the program is (visual studio default path is C:\Program Files\Microsoft Visual Studio\MyProjects\<projectName>\debug) and run the executable.
Cheers,
-D
-
thanks for your help guys :-)
RiVa