Jump to content
  • Advertisement

Archived

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

Betrayer_of_Code

system("pause");

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

Is there a way to edit or make my own text in system pause. Or a different code that would do the exact same thing....? thanx My funnies: "My mom was a ventriloquist and she always was throwing her voice. For ten years I thought the dog was telling me to kill my father." and: "The longest word in the english language is the one that follows the phrase, ''''And now a word from our sponsor''''."

Share this post


Link to post
Share on other sites
Advertisement
I remember taking a Java class when I was 14, barely remembering anything about it, but that could be from the teacher. When he needed the system to pause long enough, he just had us make a hugeass for() loop in the middle of our code.

-Ryan "Run_The_Shadows"
-Run_The_Shadows@excite.com
-The Navidson Record! The best film you''ll never see!

Share this post


Link to post
Share on other sites
you can make your own pause function

void pause(int time) // in mille seconds
{
cout<<"Pause Message";
int last_time=timeGetTime(); // or approitate clock
while(true)
{
if((timeGetTime()-last_time)>=time){break;
}
return;
}

Share this post


Link to post
Share on other sites
quote:
Original post by Run_The_Shadows
I remember taking a Java class when I was 14, barely remembering anything about it, but that could be from the teacher. When he needed the system to pause long enough, he just had us make a hugeass for() loop in the middle of our code.

-Ryan "Run_The_Shadows"
-Run_The_Shadows@excite.com
-The Navidson Record! The best film you''ll never see!


With all due respect to your teacher, this is probably the absolute worse way to pause, even when not coding a Windows app (where the pause would merely munch CPU needlessly when it could be used to, say, preload or whatnot, or process messages the window receives).

For one thing it isn''t very portable. If you run the program on an other PC, chances are unless you have the exact same configuration on both PCs, the loop will execute at a different speed and thus your delay will be off by a certain degree.

Can anyone say "old dos games that are a blur on new PCs"?

Sorry, just felt like mentionning it.

Share this post


Link to post
Share on other sites
he''s talking about "Press any key to continue..." something VC++ adds in in debug mode i think...but other compilers have in explicitly in the code to pause at the end...otherwise, programs that simply do something and output would scroll by fast then quit right away. to answer your question, do this:

void MyPauseFunction(void)
{
char whocares;
cout << "Your text here (press any key to continue)";
cin >> whocares; // this simply waits
// for input then continues
}

int main(void)
{
MyPauseFunction();
return 0;
}

hope that helps.

Brian

Share this post


Link to post
Share on other sites
If you really wanted to alter what the text was for the system pause command, then you''ll need to actually hex edit one of the dlls containing the information for the text for system pause. If you knew what dll to look in, then it shouldn''t be hard to hex edit it...

Share this post


Link to post
Share on other sites
I dont think that he wants to go to that extent...it sounds like he wants to just output text then wait for the user to hit any key...which i just realized...my above posted code requires the newline character (pressing enter)...but you can do it with cin

brian

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!