Program execution delay II

Hi all! I now have new problem with execution delay. Yesterday I had similar issue and I got help in resolving it. All worked fine in C++, but when I tried to put it in C++Builder it started acting funky.
I was suggested to use
1
2
3
4
5
6
7
8
#include <windows.h>
...
while(!Q.empty())
  Q.pop();
  // ---> code...
  Sleep(5000);
  }   
}  

In C++Builder it runs Sleep function first, so program actually sleeps for almost a minute, and then I get all results at once. I really need this time delay to work properly in C++Builder. Anyone has any other suggestions?
Last edited on
By all results you mean the output to std::cout? In that case, try to flush before you sleep.
1
2
3
std::cout.flush();
// or
std::cout << std::flush;
Actually, no. I am working with graphics, and I need results acquired in that while loop to be shown with pauses between them.
Program is quite fast, so all the points I get come out at the same time, and I need them to appear one by one as they are calculated.
I just realized I can use Timer option in C++Builder. I haven't managed to implement it yet, but I believe it will do the trick.
Thank you for trying to help :)
Topic archived. No new replies allowed.