Advertisement

problem with bloodshed

Started by July 27, 2000 02:53 AM
9 comments, last by berp 24 years, 4 months ago
I have just started to learn c++ and I am using the bloodshed compiler to make dos programs, and whenever I run my tiny little "Hello World" program it gives me about 1/2 a second to see what ive done (or screwed up) before minimizing again. Is there any way to keep the dos window up longer so I can actually see my program without getting an epileptic fit?? please help the newbie!
Try to execute the program from a manually created dos window. That usually does the trick. The same thing happens if you ping from the run window off the start button. I believe there is also a setting that you can apply to your standard dos window so that when it is called it stays open even after the application is finished. I am not sure what it is or how to set it though I do think it exists.

Kressilac
Derek Licciardi (Kressilac)Elysian Productions Inc.
Advertisement
quote: Original post by berp

I have just started to learn c++ and I am using the bloodshed compiler to make dos programs, and whenever I run my tiny little "Hello World" program it gives me about 1/2 a second to see what ive done (or screwed up) before minimizing again. Is there any way to keep the dos window up longer so I can actually see my program without getting an epileptic fit?? please help the newbie!




hi,

try this.

#include
#include // getch();


void main(void)
{

std::cerr << "Hello world" << std::endl;

getch();
}

Depending on the compiler you use, you will also find
function like hitkb() for hit keyboard.


cu

Peter









HPH
quote: Original post by phemmer

Original post by berp

I have just started to learn c++ and I am using the bloodshed compiler to make dos programs, and whenever I run my tiny little "Hello World" program it gives me about 1/2 a second to see what ive done (or screwed up) before minimizing again. Is there any way to keep the dos window up longer so I can actually see my program without getting an epileptic fit?? please help the newbie!




hi,

Oops, the Html has swallowed my include brackets so:

try this.

1. include is iostream
2. include is conio.h


cu

Peter

woah, that looks complicated thanks
Can''t you just add a scanf before the return 0 line? That would wait for the Enter key to be pressed before exiting the program.


BeS
It's Da BOMB Baby!!!
BeSIt's Da BOMB Baby!!!. o O ~ A little nonsense now and then,is relished by the wisest men~ O o .-- Willy Wonka
Advertisement
system("PAUSE");

conio.h is not portable and not ansi standard

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
I also use the Bloodshed compiler, and the best and most effictient way to handle this situation is to include conio.h, and at the end of your program, before you return 0, use the getch() function.

example:

-----------------------------------------------------------------

#include
#include

int main()
{
cout<<"Hello world!";
getch();
return 0;
}

-----------------------------------------------------------------
Note: the 2 includes up there were cut off.

they were:
1) iostream.h
2) conio.h
Try right-clicking on your exe and from the menu go to properties, then the program tab, and near the bottom should be a Close on Exit [x] box like that, just make sure that it isn''t checked and your app wont automatically close the window when it finishes.

------------
- outRider -

This topic is closed to new replies.

Advertisement