Hi,
when you have,
cout<<"WASSUP";
Sleep(1000);
my question is: Is there a way to purge the cout buffer because right now, my program is going to sleep before printing out "WASSUP" to the screen...
thx
Hi,
when you have,
cout<<"WASSUP";
Sleep(1000);
my question is: Is there a way to purge the cout buffer because right now, my program is going to sleep before printing out "WASSUP" to the screen...
thx
Which is the master, which is the student?
this works fine, what do the parameters mean though? a 100 seconds?
Code:#include <iostream.h> #include <dos.h> main() { cout<<"falling asleep"<<endl;//notes sleep(100); cout<<"waking up"; return(0); }
sleeps parameters are milliseconds, so 1000 is 1 second.
All spelling mistakes, syntatical errors and stupid comments are intentional.
well, i compiled, exed, waited, waited, waited, went to the bathroom, chated with my wife, brought the groceries in from the car, and it was still running. when i set it to 100 it took about 30 seconds? what's the deal?
!!You did all that in 100 seconds!!waited, waited, waited, went to the bathroom, chated with my wife, brought the groceries in from the car
sleep(1000) runs for 1 second for me.
All spelling mistakes, syntatical errors and stupid comments are intentional.
Hi,
When you do a "cout"..does it ouputs to the screen immediately or is it inserted into some buffer and it outputs to the screen what that buffer is full?
I'm having problem with the timing of cout...seems like whenever cout finally prints something on the screen, it's a big chunk of data...(I'm guessing cout prints to the screen when the buffer's full which explains the problem i'm having ...)
Which is the master, which is the student?
c_coder, bcc55 says i have an outdated header, could that be why it takes so long?
btw, i have the abilty to manipulate time in such a way that what takes a normal person a few minutes, takes me only 100 seconds
Maybe, I'm using msvc so I may have a different sleep function to you anyway.bcc55 says i have an outdated header, could that be why it takes so long?
All spelling mistakes, syntatical errors and stupid comments are intentional.
Well I suspect that it is sent to the screen via a buffer, however it should be displayed immediatly, post a program that dosen't work properly.When you do a "cout"..does it ouputs to the screen immediately or is it inserted into some buffer and it outputs to the screen what that buffer is full?
All spelling mistakes, syntatical errors and stupid comments are intentional.
jez, copy mine into your editor and tell us what happens
from what i know -
Sleep with "S" is in milisecs
sleep with "s" is seconds
this is probablt compiler specific, i think borland uses "s"
-
Blight2:
I tried your code and it works fine..
cout displays onto the screen before the wait command...
I wonder why my code is doing the display late..
In my code, I have the main function call a display function (cout << "My display is late..";..
void display() {
int main() {
display();
continue;
main (); //Here I call main again, is this a good
//programming practice?
}
Which is the master, which is the student?
Sorry about the above post, I accidently hit TAB and then hit the SPACE BAR...
Blight2:
I tried your code and it works fine..
cout displays onto the screen before the wait command...
I wonder why my code is doing the display late..
In my code, I have the main function call a display function
void display() {
cout << "My display is late";
while(!kbhit())
{ // do nothing }
}
int main() {
display();
continue;
main (); //Here I call main again, is this a good
//programming practice?
}
My problem is "My display is late" doesn't outputs to the screen until I hit the keyboard....which is not good
Which is the master, which is the student?
wow, that's all mixed up to me. try this:
"Sleep" doesn't seem to work in borland (at least dos.h) is there another?Code:#include <iostream.h> #include <dos.h> void display(); main() { display(); sleep(10); display(); return(0); } void display () {cout << "My display is late"; }
Should I make a console application or a win32 application for the above code??
Which is the master, which is the student?