Archived

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

compiler...

This topic is 5653 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

quote:
Original post by Strife10110
now that i found one... why won''t the little black screen thingy stay on the screen???


Huh???? Do you mean the command prompt?

Paste this

%SystemRoot%\system32\cmd.exe

into the start menu run command box. If what appears is what you mean, then that is called the "command prompt" it''s also known as the "console" as well as "dos prompt" and "dos box" - although it no longer has anything to do with DOS.

Share this post


Link to post
Share on other sites
I think he''s referring to the (common newbie) problem with the console going away as soon as the program finishes.

Strife - try running the program from the command prompt to begin with. Follow LessBread''s suggestion, cd your way to where your exe is, and type it''s name.

Share this post


Link to post
Share on other sites
quote:
Original post by Arild Fines
I think he's referring to the (common newbie) problem with the console going away as soon as the program finishes.



I thought that might be the case, but I didn't want to assume anything right off, so I asked the most obvious question. If that happens to be the case, I suppose a link to a tut on console commands is likely warranted - strife might interpret "cd" as "compact disk" rather than "change directory"...

The run string: %SystemRoot%\system32\cmd.exe will likely open the prompt to the windows system directory. In that case it will be necessary to navigate downward towards the root and then back up to where your executable is. For example:


c:\windows\system32>
c:\windows\system32>cd /?
(help info regarding the cd command)
c:\windows\system32>cd\{enter}
c:\>
c:\>cd projectdir{enter}
c:\projectdir>cd projectsubdir{enter}
c:\projectdir\projectsubdir>project.exe{enter}
(project.exe output)
c:\projectdir\projectsubdir>
c:\projectdir\projectsubdir>exit{enter} (closes the window)




[edited by - lessbread on June 24, 2002 5:27:57 PM]

Share this post


Link to post
Share on other sites
You can also use
system("PAUSE") 
right before your main function ends. However, I believe this is DOS/Windows specific.

/*=========================================*/
/* Chem0sh */
/* Lead Software Engineer & Tech Support */
/* http://www.eFaces.biz */
/*=========================================*/

Share this post


Link to post
Share on other sites
I might get killed for doing this (STL everywhere! Ahhh! ), but this will also work:


    

#include<iostream.h> //yes, that's right, .h :)


int main()
{
cout<<"Hello world";

//the follow part will keep the output on the screen

int x;
cin >> x;

return(0);
}



Basically, you're stalling the program by having the user input something. The output should stay up until they do so.

[edited by - Peon on June 25, 2002 3:49:14 AM]

Share this post


Link to post
Share on other sites