rach
rach

Reputation: 691

sleep function in c, unix

What do i need to import to use the sleep function in unix? i know it's windows.h for windows, but what about unix?

Upvotes: 4

Views: 22886

Answers (3)

dotNet Zombie
dotNet Zombie

Reputation: 134

#include <unistd.h>

THe man pages http://cis.kutztown.edu/~frye/cgi-bin/unixManPages.cgi?sleep+3C

Upvotes: 1

miku
miku

Reputation: 188234

#include <unistd.h>

Upvotes: 4

sstn
sstn

Reputation: 3069

It should be in unistd.h.

Please note that this gives you only a precision of integral seconds.

The most portable way for sub-second precision should be (ab-)using select().

Upvotes: 7

Related Questions