Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Xeract

Need some help with C++.....

This topic is 5988 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I am trying to learn C++, andI am having a problem where everything is fine until i run the program, then the screen quickly flashes up for a split second and i can see the program, then it disapears again. No matter what i do i cant get it to stay up for longer than 1/2 a second. Can anyone help please? thanks

Share this post


Link to post
Share on other sites
Advertisement
Usually i do this right before the "return 0": system("pause");


------------------------------
BASIC programmers don''t die, they just GOSUB and don''t return.

Share this post


Link to post
Share on other sites
alright....well i know how to use two operating systems, windows and linux.
I am guessing you are using windows, but I will tell you how do it on Linux next.

1) Go into MS-DOS
2) type CD \
3) type CD directory
for example, to get to C:\sierra\Half-Life, type CD \sierra\Half-Life
4) Then, just type the name of the program, you dont need to add the .exe to the name of the file if you dont want to.


In Linux:
1) Go into Konsole
2) Like in MS-DOS, use cd \directory
3) Instead of typing the name of the program, you would probably have to type ./ or \. or something (i cant exactly remember, I havent been on linux for about a week, i always get mixed up for some reason) and after the ./ thing type the name of the program (i think you might need a space after the ./ but im not sure)

Share this post


Link to post
Share on other sites
quote:
Original post by anarchyhl
1) Go into Konsole

Or XTerm, ETerm, ATerm, Gnome Terminal, or whatever .
quote:
Original post by anarchyhl
3) Instead of typing the name of the program, you would probably have to type ./ or \. or something (i cant exactly remember, I havent been on linux for about a week, i always get mixed up for some reason) and after the ./ thing type the name of the program (i think you might need a space after the ./ but im not sure)

Well, you could add ''.'' (current directory) to your PATH (environment variable), and then you wont have to add the ''./'' unless the ''.'' is in your PATH after the path of something with the same name. I remember that it ''./'' because unixes use ''/'' for directory seperation, and I remember that because the other slash ''\'' is the ''precedes a literal character'' slash (besides that, it''s a habit now ). There''s no space after the ''./'' since the command line would think it''s a seperate ''word'' and try to execute ''./'' by itself.

Share this post


Link to post
Share on other sites
this is my thing:

        
#include <stdlib.h>

int main()
{
....//somestuff

/*#1:*/ system("pause"); //you'll get text though...
/*#2:*/ Sleep(3000); //every thousand is a second...
/*#3:*/ getch(); //you shouldnt use using namespace std;
/*#4: use MSVC++ , this compiler is the best! */

return 0;
}



[edited by - Pipo declown on June 1, 2002 11:54:04 AM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!