Linux Text Slowdown- HELP PLEASE
-
char* pchText = "Ghost types"; while(*pchText!='\0') { cout<<*pchText++; Sleep(2000); } return 0; tell me what this do in you machine. I'm waiting.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
VuNic wrote:
*pchText++;
you know this is bad coding, but you push a newbie into it ?! evil you are ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
VuNic wrote:
*pchText++;
you know this is bad coding, but you push a newbie into it ?! evil you are ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
Hey VuNic could you tell me why this is conflicting code and give me an alternative? :rolleyes:
-
VuNic wrote:
*pchText++;
you know this is bad coding, but you push a newbie into it ?! evil you are ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
lol it isn't bad if we get used to. well, to newbies yes, may be you are right, let him find that out. :) sooner or later he'll find something like that and it's helps him there ;)
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
-
VuNic wrote:
*pchText++;
you know this is bad coding, but you push a newbie into it ?! evil you are ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
How can I slow down text with a 2-second timing in between letters? The following will not work: #include main() { /* And yes, sleep(2); actually takes up two whole seconds for some reason */ printf("\n\nH"); sleep(2); printf("e"); sleep(2); printf("y\n\n"); sleep(2); return 0; } /* For some reason this code FIRST executes the "sleep();" functions first. It then gives the output "Hey" all in one shot four seconds later. I am using Ubuntu if that helps, but I guess everyone else is using Windows because it seems to work on their computers. */
Try calling fflush before each sleep call; this way, the text in stdout's buffer gets pushed to the console immediately:
printf("\n\nH");
fflush(stdout);
sleep(2);printf("e");
fflush(stdout);
sleep(2);printf("y\n\n");
fflush(stdout);
sleep(2); -
Hey VuNic could you tell me why this is conflicting code and give me an alternative? :rolleyes:
std::string str = "A Good Spirit Types";
std::string::iterator it;
for ( it=str.begin() ; it < str.end(); it++ )
{
std::cout <<*it;
Sleep(2000);
}This one's okay?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
-
std::string str = "A Good Spirit Types";
std::string::iterator it;
for ( it=str.begin() ; it < str.end(); it++ )
{
std::cout <<*it;
Sleep(2000);
}This one's okay?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
much much better :rolleyes: it would be even better if you wouldn't put that horrible
using namespace std;
at the beginning of your code ;P[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
much much better :rolleyes: it would be even better if you wouldn't put that horrible
using namespace std;
at the beginning of your code ;P[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
-
std::string str = "A Good Spirit Types";
std::string::iterator it;
for ( it=str.begin() ; it < str.end(); it++ )
{
std::cout <<*it;
Sleep(2000);
}This one's okay?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
I prefer the first release. Just a note,
**S**leep
is not available onLinux
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
I prefer the first release. Just a note,
**S**leep
is not available onLinux
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]Yeah even I like the first one. But Tox the tiger commands things and I end up changing to what he asks :D Tox Rox! And yes I just noticed in a Linux site, Linux sleeps a bit different with C++ there. lol ;) . gudnite!
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
-
lol it isn't bad if we get used to. well, to newbies yes, may be you are right, let him find that out. :) sooner or later he'll find something like that and it's helps him there ;)
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
I agree, that's not bad code at all. Just code. Newbies should masters such
C
-like constructs in order to masterC++
. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Try calling fflush before each sleep call; this way, the text in stdout's buffer gets pushed to the console immediately:
printf("\n\nH");
fflush(stdout);
sleep(2);printf("e");
fflush(stdout);
sleep(2);printf("y\n\n");
fflush(stdout);
sleep(2);AWSOMENESS!!!PERFECT. I got it now. Adam Maras I am forever your servant. Thanks All for your help :-D :-D :-D :-D :-D :thumbsup:
-
VuNic wrote:
*pchText++;
you know this is bad coding, but you push a newbie into it ?! evil you are ;P
[VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]
That's not bad coding at all.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke