I'm not sure if i get 100% what your asking, but here something for you to try. you can #include <windows.h> and then type Sleep(5000); the number is in milliseconds
Hence you should use not just a simple loop, comaring clock() to endwait, but you should also use sleep in you loop. Even if it's just for a very short time you can free your processor for other executions by using sleep.
It obviously depends in what range you wan't to be able to stop your program, but if you want to wait for something for 5 seconds you can use
1 2 3 4 5 6
void wait(long milliseconds){
registerlong endwait;
endwait = clock() + milliseconds * CLOCKS_PER_SEC * 0.001;
while (clock() < endwait){sleep(500);} //500ms may be quite inaccurate, but if
//it is too inaccurate you can also use sleep(100) or sleep(50).
}
I just used the Sleep() function in windows. h and it works and does the job what i expected.
Can anyone tell me what all other functions are there in this header file ?
jmc: The whole point of wait() is not to use Sleep() or any other unportable functions. If you're going to use Sleep(), then wait() is unnecessary. Just call Sleep(x) and get it over with.