system("pause");
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''''."
system() executes a command on your system, i.e., try going to dos or a command prompt and type ''pause'' and see what happens.
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!
-Ryan "Run_The_Shadows"
-Run_The_Shadows@excite.com
-The Navidson Record! The best film you''ll never see!
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;
}
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;
}
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.
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
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
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...
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
brian
cin.get() will act like a "press any key to continue"
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
The hackers must have gotten into the system through the hyperlink!!
Invader''s Realm
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement