Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

.exe command problem


ghost's Avatar
0 0

In some .exe if there is a cmd popup without input it will just pop up and disappear not displaying anything, but as i leave c++ it became an issue to me making beginner programs. Even with input i will input it and the output will popup and the command prompt will dissapear.

specs- 149gb hdd os- winxp im using dev C++ to compile

if you need anymore specs just say so and i can get em


ghost's Avatar
0 0

Try adding the line:

markupsystem("pause");

to the end of your program, right before the return 0; , that will make the program display "Press any key to continue" and will wait for you to press a key before ending.

You could also run the program from the CMD prompt instead of double-clicking the file in explorer.


ghost's Avatar
0 0

Yehr while youre still beginning to learn the language, Id recommend running most of ur programs from the cmd prompt.


ghost's Avatar
0 0

just use getchar(); before return 0;

and if you won't want to add some lines, just run it under cmd prompt like they said.

Or you add <windows.h> and use the messagebox api for your output and be a l33t win32 coding ninja :ninja:

i wouldn't go for system cause that requires another header.


ghost's Avatar
0 0

open the .exe file with cmd


Ingelo's Avatar
q|^.^|p - Say w00t!
0 0

mastergamer wrote: Try adding the line:

markupsystem(&quot;pause&quot;);

I would rather use markupcin.get();


ghost's Avatar
0 0

well right now i just compile the programs but i could try running from the cmd, but is there anyway to fix this for other causes like installations, id just rather nit have the cmd pop up and go away, id like to know what its doing.


n30's Avatar

n30

Member
0 0

try adding the "system pause" at every other line if all else fails. Do it only for debugging. Don't use "system pause" in your final version, because it requires an extra header, and not all OSs support it.


ghost's Avatar
0 0

ok i tried opening just from the cmd prompt and it works fine, if needed ill use system pause


ghost's Avatar
0 0

As pointless as this post is, I'd just like to point out Anarcho's hypocritical suggestion =P.

I wouldn't use system(); though because that requires another header

You could include <windows.h> and use MessageBox() and be a l33t win32 ninja