bug-sh-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Buggy sleep()


From: admin
Subject: Buggy sleep()
Date: Tue, 03 Apr 2001 13:17:08 GMT

Hello,
I have noticed very strange bahaviour of sleep() function.
Here are two examples:

/* Ex1 */
#include <unistd.h>
int main()
{
printf("something1");
sleep(1);
printf("something2");
return 0;
}

/* Ex2 */
#include <unistd.h>
int main()
{
printf("something1\n");
sleep(1);
printf("something2\n");
return 0;
}

Could you please expalin me the differences between given examples, except
new lines \n in printf().
The "bug" is that in Ex1 both strings are printed AFTER the sleep time.
The examples were compiled and tested under Slackware 7.1 gcc-2.95.2

Reagrds,
Milina Giuzleva
Visit A Line Internet Clubs - po-dobrite clubove!!!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]