Gee wiz. Sorry for asking so many questions guys but I have been having bad luck finding what I am looking for. I have a problem you see. I am making a program that has to do with racing horses...Or in this case blank " " with colored backgrounds. I have been using gotoxy all this way and I need to know how to make them move without them moving in an instant. The only option I have is using sleep. Is there a better way? Is there an better way to use sleep?
Sleep is the best option in this case, delaying a program goes against the grain for most programmers because speed is usually a concern. The sleep and delay functions were created as a convenience in such situations where you need the program to wait for a bit. But beware using them, they aren't standard and you code will not be portable because of that.
what if you sent the program through a loop that counted to a million or something?
>what if you sent the program through a loop that counted to a million or something?
That wouldn't work because different computers will take different amounts of time to loop the same number of times. If you need precise timing then a delay function is what you want since they use the system time as a basis for their operations.
Yeah, include time.h and use this....
It's a little touchy at times, but I use it.
int wait(int SecondsToWait)
time_t TheTime = time(NULL);
while(time(NULL) - TheTime < SecondsToWait);