Are you planning to be doing anything else whilst waiting for the time to elapse?
Since you're using TurboC, which can only create DOS programs, and DOS is the worst operating system for writing anything with any asynchronous behavior, you're in for a hard time.
... or instead of a full-blown TSR, if the user-defined call is only to be made while your application is running, write an interrupt handler for the 18-times a second user interrupt in DOS, and make your handler keep an eye open for the time and call the correct function.
But do remember that when the call is made, the processor may not have been handling your application, so the data segment may be wrong, the stack may be wrong (or even very, very small) etc.
Good point. Back in the old days it was important to daisy-chain any interrupt you diverted, because if you wanted to use it, who knows who else might also have wanted to use it...
But nowadays I can't imagine many people running a DOS environment with several applications. The nice thing about windows dos-boxes is that they lead an independant confined existance, and what goes on in them shouldn't mess up anything else after they're closed.
Well I use cygwin compiler, I recommend it. Umm I don't know if it will work without cygwin but ex. sleep(5); would make the program stop for 5 seconds before continuing. Again I think that is a cygwin only command, but good luck.
Switch to another compiler, why are you keep using TurboC on Windows 98.
Than use function SetTimer to set the timer and catch the WM_TIMER message Windows will send after the timer will expire. After finishing, kill the timer with KillTimer
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.