Delay A While Loop
Good day !
Is there any functions that allows me to slow down a while loop ?
For example, I wish to display a list of numbers using a While loop and of cauz it's impossible to read all the values in the monitor since the processor speed is quite fast.
So what should I do in order to have the while loop, loops once and then wait for specific of duration then only continue looping once and wait again and so on ?
I remember there's a function that allows me do that but i can hardly remember what's that. I try to search around but failed.
Thanks a lot !
Sonic Wave :confused:
Hi. I don't know the library function, but I have one I modified from an example:
//__Copyright 1997 Chris H. Pappas,Phd. __//
int poz(int x)
T3=(time(&T2)) + x;
while(time(&T2) < T3);
poz(2); // ...will pause for 2 seconds
I am sorry but I don't know the one that pauses for durations shorter than a second, but this should still work in your loops...
You could use either QueryPerformanceCounter
LARGE_INTEGER *lpPerformanceCount // pointer to counter value
to get precision timing.
Just use Sleep. Its defined in windows.h and it takes as a parameter the number, in milliseconds, that you want it to delay.
would delay your program for 1 second.
Thank You !
Good day !
Thanks a lot for the advices and recommendations !
I will look into all of them :)
Thanks again ;)