| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4931 人关注过本帖
标题:DEV C++中有没有delay() 函数呀?
只看楼主 加入收藏
随心
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:12
帖 子:2577
专家分:250
注 册:2007-8-12
收藏
得分:0 
在TC里是秒吧
在DEV-C++下是毫秒
我说的是sleep

[[italic] 本帖最后由 随心 于 2008-1-8 11:38 编辑 [/italic]]

天之道,利而不害。圣人之道,为而不争。信言不美,美言不信。善者不辩,辩者不善。知者不博,博者不知。
2008-01-08 11:34
zbqf109
Rank: 1
等 级:新手上路
帖 子:289
专家分:0
注 册:2006-12-31
收藏
得分:0 
回复 11# 的帖子
是的。
在<stdlib.h>里面,sleep函数声明前面有这样一句注释:
/*
 * NOTE: Officially the three following functions are obsolete. The Win32 API
 *       functions SetErrorMode, Beep and Sleep are their replacements.
 */
这里它说的三个函数就是:
_CRTIMP void __cdecl    _beep (unsigned int, unsigned int);
_CRTIMP void __cdecl    _seterrormode (int);
_CRTIMP void __cdecl    _sleep (unsigned long);
这三个函数已经“过时”,他们被Win32 API相应的函数代替。既然代替,函数参数、返回值应该是一样的。我们来看一下MSDN里面关于Sleep的说明:
VOID Sleep(
  DWORD dwMilliseconds   // sleep time
);
dwMilliseconds
[in] Specifies the time, in milliseconds, for which to suspend execution. A value of zero causes the thread to relinquish the remainder of its time slice to any other thread of equal priority that is ready to run. If there are no other threads of equal priority ready to run, the function returns immediately, and the thread continues execution. A value of INFINITE causes an infinite delay.
再看DWORD
DWORD :  A 32-bit unsigned integer or the address of a segment and its associated offset
换句话说,DWORD在这里就是unsigned long

TC下面的函数没有任何参考意义。

坚决不跟用TC的人打交道!
2008-01-08 12:13
devfhpgah
Rank: 1
来 自:江西
等 级:新手上路
帖 子:204
专家分:0
注 册:2007-8-16
收藏
得分:0 
谢谢了,学到了

努力才会成功!
2008-01-09 20:38
随心
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:12
帖 子:2577
专家分:250
注 册:2007-8-12
收藏
得分:0 
学习了。

天之道,利而不害。圣人之道,为而不争。信言不美,美言不信。善者不辩,辩者不善。知者不博,博者不知。
2008-01-09 20:42
dousao
Rank: 2
等 级:论坛游民
帖 子:228
专家分:58
注 册:2007-11-8
收藏
得分:0 
sleep也是毫秒,一般都是1000*多少来调用的哈.
vc下能用,win-tc没试过.不过win-tc和tc一样.tc不能
2008-01-09 20:57
xDevil
Rank: 1
等 级:新手上路
帖 子:53
专家分:0
注 册:2007-8-31
收藏
得分:0 
tc下的sleep()是秒。cfree和devc++是_sleep(),单位是毫秒。tc是古董了。。
2008-01-09 21:34
快速回复:DEV C++中有没有delay() 函数呀?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015859 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved