1、睡眠功能介绍:
2、功能名称:睡眠
(资料图片)
3、功能:暂停执行一段时间。
4、Usage: unsigned sleep (unsigned millisecond);
5、在VC中使用头文件
6、#include
7、在gcc编译器中,不同的gcc版本使用不同的头文件。
8、#include
9、睡眠功能注意:
10、在VC中,睡眠中的第一个英文字符是大写的“s”
11、在标准C中,它是Sleep,不是大写的.我们用大写的单词来解释吧,看你用什么编译器了。简单来说,VC用睡眠,其他都用睡眠。
12、睡眠功能的一般形式:
13、Sleep(unsigned long);
14、其中,Sleep()中的单位是毫秒,所以如果你想让函数停留1秒,应该是Sleep(1000);
15、在Linux下,sleep中的“s”不是大写的。
16、sleep()中的单位是秒,而不是毫秒。在内核中,睡眠是通过暂停功能和闹铃功能实现的。
17、The description of sleeping in the standard library is as follows: _ Cr TIMP Void _ _ CDECL _ _ MingW _ Not Row _ Sleep (unsigned long)_ MINGW _ ATTRIB _ DEPRECATED; It can be considered that mingw abandoned the sleep function,
18、睡眠功能示例:
19、#include
20、#include
21、int main()
22、{
23、int a;
24、a=1000;
25、printf("你");
26、Sleep (1); /* VC uses sleep */
27、printf(" good ");/*在“你”和“好”之间会有1000毫秒的间隔,也就是一秒*/
28、return 0;
29、}
本文到此结束,希望对大家有所帮助。
标签:
X 关闭
X 关闭