Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

sleep() in C

Name: Anonymous 2012-09-03 0:27

So, I've been trying to use the sleep function in C, but I have a problem. If I use it once, like, for example:

printf("First Line.\n");
sleep(5);
printf("Second Line.");

Then it works just fine. But if I try doing that same thing, so:

printf("First Line.\n");
sleep(5);
printf("Second Line.\n");
sleep(5);
printf("Third Line.");

It just waits 10 seconds then displays the next two lines at once. Is there some work around for this?

Name: Anonymous 2012-09-03 5:13

be sure to fflush(stdin); too, lel

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List