在Windows休眠功能,采用C [英] sleep function in Windows, using C

查看:127
本文介绍了在Windows休眠功能,采用C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要睡我的Windows程序。什么头文件具有休眠功能?


解决方案

 的#include<&WINDOWS.H GT;
睡眠(sometime_in_millisecs); //注意大写小号

这是第一个结果google搜索MSDN休眠,我认为你可能会管理自己的时候。

和这里是与MinGW的编译和做什么它在锡说一个小例子:

 的#include<&WINDOWS.H GT;
#包括LT&;&stdio.h中GT;诠释主(){
    的printf(开始睡觉... \\ n);
    睡眠(3000); //睡眠3秒
    的printf(休眠结束\\ n);
}

I need to sleep my program in Windows. What header file has the sleep function?

解决方案

#include <windows.h>
Sleep( sometime_in_millisecs );   // note uppercase S

This is the first result when googling for "msdn sleep", which I think you could have managed yourself.

And here's a small example that compiles with MinGW and does what it says on the tin:

#include <windows.h>
#include <stdio.h>

int main() {
    printf( "starting to sleep...\n" );
    Sleep( 3000 );   // sleep three seconds
    printf( "sleep ended\n" );
}

这篇关于在Windows休眠功能,采用C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆