Quote:
Originally Posted by Shyla_Johnson
Hi, I am a new programmer also, I am using devcpp, and i am able to compile my programs, and run them, but the output just flashes and goes away, how can i view my output for more than a milisecond, what am I doing wrong?
|
Quote:
Originally Posted by sh_erfan
you should include <conio.h> header file.
this header has a function getch(). you can use it before return statements in all programs you write in order to see the result on screen until a key is pressed.
Code:
#include <conio.h>
.
.
.
main()
{
//your code goes here
getch();
return 0;
}
I sure am this will work if I got your question correctly !!!!
|
I second above solution by "sh_erfan" as I use same method.
plus
U can use any of following method:-
1) either use getch() as shown above 'getch() stops program until a character is pressed on keyboard (none toggle keys) so you can easily enjoy output from your program for as-long-as-you-like.'
2) OR run your program from within visual studio/vc++ ide
3) OR run your application/program from dos prompt :D using following method.
3.1) make shortcut for cmd.exe. If you know how then skip to 3.2
3.1.1) right click in side debug folder containing your win32 aplication
3.1.2) go to new and click on shortcut in sub menu
.
EITHER DO
3.1.2.1)
3.1.2.1.1) copy and paste " C:\WINDOWS\system32\cmd.exe " if u r using xp
3.1.2.1.2) change drive letter C to what-ever-is-your xp installed on.
OR
3.1.2.2)
3.1.2.2.1) click on brows and go to my computer then C drive then WINDOWS then
SYSTEM32 and then find and click on cmd
3.1.2.2.2) click ok
.
3.1.3) click next
3.1.4) click finish
3.1.5) right click on the short-cut just created with name cmd and click
properties
3.1.6) select shortcut tab if already not selected
3.1.7) select and delete the text written in front of 'Start in'
3.1.8) click apply
3.1.9) click ok
3.2) double click on shortcut just made
3.3) type name of the program and press enter key
3.4) type exit and press enter to end cmd.exe
3.5) next time just double click on shortcut, type win32 application name and
press enter. You will get what you wanted
3.6) Plus where-ever you want to use this shortcut you just made copy from
here and paste there. it will work as long as it is on same computer.
otherwise remake shortcut.
3.7) that is what u wanted so *mission is complete*
.