Be a Supporter!

msdos box Disappears after Running.

  • 456 Views
  • 8 Replies
New Topic Respond to this Topic
Engalde
Engalde
  • Member since: May. 23, 2006
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
msdos box Disappears after Running. 2006-12-04 18:05:53 Reply

In Bloodshed Dev-C++ When I compile and test run the msdos box will appear only for split second and disappear. So I have go into in manually and use the
cd \ gotto directory commands and luanch it.

is there a way to fix this?


Unblock Newgrounds at school or work.

DFox
DFox
  • Member since: Aug. 9, 2003
  • Offline.
Forum Stats
Member
Level 30
Blank Slate
Response to msdos box Disappears after Running. 2006-12-04 18:09:37 Reply

I think you can just put getch(); at the end of your program.


BBS Signature
authorblues
authorblues
  • Member since: Jun. 21, 2005
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to msdos box Disappears after Running. 2006-12-04 18:11:26 Reply

At 12/4/06 06:05 PM, Macrodia wrote: In Bloodshed Dev-C++ When I compile and test run the msdos box will appear only for split second and disappear. So I have go into in manually and use the
cd \ gotto directory commands and luanch it.

is there a way to fix this?

the command prompt kills itself once the script is done executing. add in a line to get a key stroke or something:

cin.get();


BBS Signature
Engalde
Engalde
  • Member since: May. 23, 2006
  • Offline.
Forum Stats
Member
Level 07
Blank Slate
Response to msdos box Disappears after Running. 2006-12-04 18:45:50 Reply

At 12/4/06 06:11 PM, authorblues wrote:
At 12/4/06 06:05 PM, Macrodia wrote: In Bloodshed Dev-C++ When I compile and test run the msdos box will appear only for split second and disappear. So I have go into in manually and use the
cd \ gotto directory commands and luanch it.

is there a way to fix this?
the command prompt kills itself once the script is done executing. add in a line to get a key stroke or something:

cin.get();

ah good idea. This works.( noob style) Declare a variable
int something;
scanf ("something");


Unblock Newgrounds at school or work.

CronoMan
CronoMan
  • Member since: Jul. 19, 2004
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to msdos box Disappears after Running. 2006-12-05 07:06:28 Reply

At 12/4/06 06:45 PM, Macrodia wrote: ah good idea. This works.( noob style) Declare a variable
int something;
scanf ("something");

or you can just use getchar();

(getch() doesn't block)


"no sound in ass"

RageOfOrder
RageOfOrder
  • Member since: Aug. 30, 2002
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to msdos box Disappears after Running. 2006-12-05 10:13:29 Reply

I myself like

#include <conioh>
getch();
return 0;

but if you want you can also do

while( !kbhit() );
return 0;

CronoMan
CronoMan
  • Member since: Jul. 19, 2004
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to msdos box Disappears after Running. 2006-12-06 09:09:26 Reply

At 12/5/06 10:13 AM, RageOfOrder wrote: I myself like

#include <conioh>
getch();
return 0;

that still won't keep the console from closing
use getchar()


"no sound in ass"

thecoshman
thecoshman
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 12
Blank Slate
Response to msdos box Disappears after Running. 2006-12-06 10:32:53 Reply

You can always use the very ugly

system("PAUSE");

but that is VERY ugly, you will see why

RageOfOrder
RageOfOrder
  • Member since: Aug. 30, 2002
  • Offline.
Forum Stats
Member
Level 09
Blank Slate
Response to msdos box Disappears after Running. 2006-12-06 11:13:19 Reply

At 12/6/06 09:09 AM, CronoMan wrote:
At 12/5/06 10:13 AM, RageOfOrder wrote: I myself like

#include <conioh>
getch();
return 0;
that still won't keep the console from closing
use getchar()

Doesn't really matter for me anyways, I compile and run my programs from an active console, not inside the IDE, anyways. So even when the program ends, my console is still open.
Although this screenshot is java, it follows the same principle.