如何向C ++程序添加定时延迟? [英] How do you add a timed delay to a C++ program?

查看:136
本文介绍了如何向C ++程序添加定时延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在C ++程序中添加一个时间延迟,并且想知道是否有人对我可以尝试什么或信息有任何建议。



我希望我有更多的细节,如何实现这个时间延迟,但直到我有更多的信息,如何添加一个时间延迟我不知道我应该如何尝试实现这个。

解决方案

Win32: 睡眠(毫秒) 是什么



< a href =http://linux.die.net/man/3/usleep> usleep(微秒) 是你想要的。



sleep()只需要几秒钟,通常太长。


I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at?

I wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed delay I am not sure on how I should even attempt to implement this.

解决方案

Win32: Sleep(milliseconds) is what you what

unix: usleep(microseconds) is what you want.

sleep() only takes a number of seconds which is often too long.

这篇关于如何向C ++程序添加定时延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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