|
Sleep or Dealy fucntion Issue
I am doing some programming using C on UNIX. The thing is, I have been working in both UNIX and Windows for practicing.
I created a Delay fucntion over Windows using DevC++ as a compiler, when I tried over the console, it worked as I expected, I mean it was creating a delay (of one second for example) between each operation.
When I tried this function over UNIX, it didn't get the same results. I would like to know what is happening. Then, I tried a Sleep function from the <unistd.h> library and it did the same. When I tried to do an operation that will be printed in the same line, the delay used between each operation is acummulated and then everything is done. For example;
Sleep(1); printf("Hi"); Sleep(1); printf("How"); Sleep(1); printf("are"); Sleep(1); printf("you?");
I have to wait four seconds to get all the expression to be printed in the screen, instead of getting each expresion with a one second delay. I hope somebody can help me out. I will aprecciate any help.
Other thing, I have been using the conio.h library of windows to put some color on the console. What can I used on UNIX? Can anybody give a working example?
|