<dos.h> 头文件在代码块中工作吗?

Does <dos.h> header file work in codeblocks?

dos.h 头文件的延迟功能在代码块中不起作用。它表明延迟功能未声明。 以下 link 包含以下程序。 link

int main  ()
{ 
printf     (  "  This c program will exit in 10 seconds.\n");         
delay(10000);                         
return 0;
}

我也遇到了同样的问题&我用了这个功能

 #include <time.h>
 void delay(int milliseconds)
 {
   long pause;
   clock_t now,then;

   pause = milliseconds*(CLOCKS_PER_SEC/1000);
   now = then = clock();
   while( (now-then) < pause )
     now = clock();
 }

已编辑:

如评论所述,这确实会使系统繁忙。我有更好的方法来做到这一点,并且适用于 CodeBlocks。

#include <windows.h>
 .
 .
 .
 Sleep(100); //sleep for 0.1 second
 .

我认为它只适用于 Turbo C。 它是 Borland 特定的,可以在 turbo c 编译器中工作。

see link