Controlling speed of a program

I would like to know how I can make a program print a line that is timed so it isn't all at once confusing the user
sleep(<time in ms>)
 
for (time_t t = time() + 5; time() < t; ) {}

google is your friend :) usually provide faster responses
Sorry for being sooo late, but why do I need the for statement
That's basically a loop that repeats until a certain time is reached, the problem here this will call time() as often as your processor or your OS will allow it, which is a huge waste of resources.
is there a better way
Topic archived. No new replies allowed.