What's wrong here?

futuristicmonkey

Golden Member
Feb 29, 2004
1,031
0
76
Anyways, I compiled, built and executed my project I made in C++ inside the compiler program. The .exe just displays some text in a black dialogue box - its one of those simple "Hello World" programs. It works..so there's nothing wrong with the .exe.

But, running the .exe from the desktop (where I saved it) results in the box opening..then quickly closing.

I've noticed this before...running some command (I have forgetten, but I know thee's a few) from Run... in the Start Menu.

What's wrong?

Thanks!
 

KeyserSoze

Diamond Member
Oct 11, 2000
6,048
1
81
Your program is probably doing exactly what it's supposed to, which is just display the text.

You need to add something in there to tell it to wait for user input, or to stay up before closing. Might I reccomend a "getch()" or "sleep".

Might want to try the programming forum, you'll be able to get more help there.

Hope this helps!




KeyserSoze
 

futuristicmonkey

Golden Member
Feb 29, 2004
1,031
0
76
Thanks for both your replies. :) The reason I posted this here was becuase I thought it had something to do with Windows.
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
The reason I posted this here was becuase I thought it had something to do with Windows.

It does, Windows makes people think that all programs should be GUI and interactive when that's really far from the truth.
 

futuristicmonkey

Golden Member
Feb 29, 2004
1,031
0
76
Originally posted by: Nothinman
The reason I posted this here was becuase I thought it had something to do with Windows.

It does, Windows makes people think that all programs should be GUI and interactive when that's really far from the truth.

Are all programmers really devils? lol, look at the avatars here...

But, seriously, I do enjoy a GUI, but cmd-line is okay when I know the commands. But, for instance, when I type in ipconfig into "Run", the box stays there. That's what I meant (I don't want to sound like a Windows Noob :eek:)
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
I'm no programmer, I'm just a network security/admin who does a bit of shell and perl scripting to make his job easier and to avoid paying out the ass for 'Enterprise level' products that can be reproduced in-house in a week or so. Don't get me wrong, I have had a few programming classes and I have studied it on my own time, it's just not my profession and I wouldn't want it to be either.

I didn't even know MS fixed ipconfig to do that, I always have a shell window open since I run most Linux and cygwin on Windows.