what is funtion for delay in VC

L

lucifer

hi
i need to insert delay in my program what function should i use
the old delay is not supported by the standard C++
 
V

Victor Bazarov

lucifer said:
i need to insert delay in my program what function should i use
the old delay is not supported by the standard C++


You could do something like

double delay_time = 10; // ten seconds
time_t t1 = time(0);
while (difftime(time(0), t1) < delay_time)
;

It's CPU-intensive, of course, but there is no other standard C++
way. You could use some platform-specific or compiler-specific
way, but you need to ask in a compiler- or platform-specific NG.
Here such things are off-topic.

V
 
I

Ivan Vecerina

lucifer said:
hi
i need to insert delay in my program what function should i use
the old delay is not supported by the standard C++
Look for a platform-specific solution.
On Windows (since you mention VC): ::Sleep(msDelayCount);

hth,
Ivan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top