sleep function in c, unix

南笙酒味 提交于 2020-02-01 04:53:20

问题


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?


回答1:


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().




回答2:


#include <unistd.h>
  • http://pubs.opengroup.org/onlinepubs/009695399/functions/sleep.html



回答3:


#include <unistd.h>

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



来源:https://stackoverflow.com/questions/5019282/sleep-function-in-c-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!