We'd like to remind Forumites to please avoid political debate on the Forum... Read More »
We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
problem with an exe
Options

Lord_Chris
Posts: 358 Forumite
in Techie Stuff
hey, since i have a ton of time to kill (cant get a job for the summer ggrrr) i've decided to try and learn C++ (mainly cos i like games :P) and i'm kinda stuck before even starting.
One of the example programs i've got is the all time favourite 'hello world' program... at first i thought i'd made a mistake when typing the code, but the example file won't work either. so heres the problem:
got the example code, Bloodshed Dev-C++ compiles it... and there on my desktop next to the saved cpp file is 'hello_world.exe' ... unfortunetly when i try to run it, command prompt opens and then dissapears instantly. obviously this would stand to be more than a slight problem since i can't actually test the code :@
suggestions appreciated
One of the example programs i've got is the all time favourite 'hello world' program... at first i thought i'd made a mistake when typing the code, but the example file won't work either. so heres the problem:
got the example code, Bloodshed Dev-C++ compiles it... and there on my desktop next to the saved cpp file is 'hello_world.exe' ... unfortunetly when i try to run it, command prompt opens and then dissapears instantly. obviously this would stand to be more than a slight problem since i can't actually test the code :@
suggestions appreciated
0
Comments
-
you need to add a press any key command so it waits.Cant remember how to do it but either someone else will know on here or just look further into your guide book.0
-
Either that or open up a command prompt and execute the program from there. It will then spew out "Hello world" and whatever other expletives you've added before coming back to the command prompt.0
-
Open a command window (Start - Run - type in cmd and press return). Now run the exe. cd to its folder for convenience.0
-
garcia wrote:Either that or open up a command prompt and execute the program from there. It will then spew out "Hello world" and whatever other expletives you've added before coming back to the command prompt.
lol... i didnt add any expletives ...alright, i didnt add many expletives
i tried that, it didnt like it when i tried using prompt to run it it didnt like it.
any ideas on the any key command please someone... save me reading a book twice
what is it about XP's command prompt? such a !!!!! compared to good ol' 980 -
Wait for a keypress in C++
#include <stdio.h>
int main(void)
!!
int ch;
printf ("Press [Enter] to continue");
while ((ch = getchar()) != '\n' && ch != EOF);
return(0);
}0 -
still no joy
wth is going on?
is there an alternative way to open exe's... like a simulator for programming development? ...probably not im guessing but anyone actually know?
is the exe meant to close cmd prompt that quickly in XP or is it a problem with mine?
this is such a (insert a creative expletive of your choice here) nuisance.0 -
Lord_Chris wrote:is there an alternative way to open exe's... like a simulator for programming development?
You say the .exe is on your Desktop. To get there open the command window and type:
cd desktop
You should now be able to run yourProg.exe and the window will remain open.0 -
For some reason when I typed the open curly bracket after the int main(void), it has replaced it with !!0
-
nickmack... i love you so much... not in THAT way, but ya know
on its own the hit enter to continue thing works fine, but how do i combine that with other code?
for example, this is what the example file for hello world is:// Hello World
// A first C++ program
#include <iostream>
int main()
!!
std::cout << "Hello World!" << std::endl;
return 0;
}
if you could point out where i need to put the hit enter to contiue bit it would be much appreciated
EDIT: the 2 exclamation marks are the open squiggly bracket thing on mine too :@
EDIT 2: even though i got it working using Chippy's method, if you wouldn't mind this could be useful later0 -
Chippy_Minton wrote:Run it using the integrated d.e.b.u.g.g.e.r in Bloodshed.
You say the .exe is on your Desktop. To get there open the command window and type:
cd desktop
You should now be able to run yourProg.exe and the window will remain open.
CHIPPY I LOVE YOU... GENIUS, TY SO MUCH, IT WORKED - YAY0
This discussion has been closed.
Confirm your email address to Create Threads and Reply

Categories
- All Categories
- 351K Banking & Borrowing
- 253.1K Reduce Debt & Boost Income
- 453.6K Spending & Discounts
- 244K Work, Benefits & Business
- 598.9K Mortgages, Homes & Bills
- 176.9K Life & Family
- 257.3K Travel & Transport
- 1.5M Hobbies & Leisure
- 16.1K Discuss & Feedback
- 37.6K Read-Only Boards