WHATS THE CODE TO WAIT (PAUSE) FOR A CERTIN AMOUT OF SECONDS ED. 5 SECONDS
Printable View
WHATS THE CODE TO WAIT (PAUSE) FOR A CERTIN AMOUT OF SECONDS ED. 5 SECONDS
include dos.h
delay(5000) //5 seconds
or if that doesn't work
include windows.h
sleep(5000)//5 seconds
and i see you got another animated avatar
For portability/compatibility you might want to include the unistd.h file instead of windows.h or dos.h.
None of them seem to work for me, I'm using Dev C++. Windows 98
>For portability/compatibility you might want to include the
>unistd.h file instead of windows.h or dos.h.
No, that won't work too well since unistd.h is only compatible with POSIX platforms and won't work on DOS/Windows systems. I've always been of the opinion that if you can't easily do it portably, do it yourself:
Or you could use conditional compilation to include the appropriate headers according to the platform the program is compiled on.Code:#include <ctime>
void mesleep ( long m )
{
clock_t limit,
c = clock();
limit = c + m;
while ( limit > c )
c = clock();
}
-Prelude
But that only works on windows...Code:#include <iostream.h>
#include <windows.h>
int main()
{
cout<<"Pauseing for 5 seconds"<<endl;
Sleep(5000); /* Notice capital 'S' in Sleep */
cout<<"Done pauseing"<<endl;
return 0;
}
>None of them seem to work for me, I'm using Dev C++. Windows 98
Have you included windows.h?
Are you using a small s instead of a big S (Like it should be) in Sleep()?