|
-
Oct 31st, 2002, 09:54 AM
#1
Thread Starter
Addicted Member
updating during loops
Im trying to print some characters on a timed loop(using GetTickCount), and i want 1 to be printed every 10 ms. But the problem is that it prints a bunch of characters over an interval larger than 10 ms. It seems not to be updating at each loop. Is there like a DoEvents statement, like in VB?
thanks
-
Oct 31st, 2002, 10:50 AM
#2
Monday Morning Lunatic
That's buffering, and there's an easy way to fix it. Are you using C or C++?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 31st, 2002, 11:09 AM
#3
Frenzied Member
You force the buffer to flush after you place something in it.
Otherwise the character(s) stay parked in the buffer, and get put to the screen in big blobs.
In C you can use fflush() --
Code:
putc(ch,stdout);
fflush(stdout);
-
Oct 31st, 2002, 11:32 AM
#4
Monday Morning Lunatic
Or for C++, use cout << flush;
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|