how do u pause a command in c++? i know how to pause using system("pause") or cin.get() but i want to know hot to make the program sleep for a certain ammount of time... like vbs' wscript.sleep 1000... if that helps

thanx

Recommended Answers

All 7 Replies

linux: sleep() or usleep() #include <unistd.h>
windows: Sleep() #include <time.h>

I'm really sorry about bringing this up again but the Sleep(); function isnt working for me. i included ctime. could someone give me an example of code for this that works? (I'm using the dev-cpp bloodshed compiler)

thanx...

ctime.h possibly?

that msdn crud says 'windows.h', but i was sure u didnt need to include all that garbage just for sleep...

Sleep is a kernel32.dll function. All exports of kernel32.dll are typically associated with windows.h.

that msdn crud says 'windows.h', but i was sure u didnt need to include all that garbage just for sleep...

#define WIN32_LEAN_AND_MEAN
#incldue <windows.h>

that cuts the crud a little ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.