Calling a function after some time in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Calling a function after some time in c++

I want to call a function after a specific amont of time in c++ I use turbo c++ compiler and visual studio (I use turbo because schools in india generaly use it and accept projects made in it only) So plz provide me a solution for both turbo and visual studio

21st Sep 2019, 4:38 AM
Saksham Narula
Saksham Narula - avatar
4 Answers
0
windows header provide sleep function. on toubro, use delay function from dos header... both takes argument in milliseconds
21st Sep 2019, 5:06 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Both actually stop the code execution and i don't want to do that as the function call is in a while loop with more things in it that should run continuously
21st Sep 2019, 5:13 AM
Saksham Narula
Saksham Narula - avatar
0
then proceed with multi threading.... one thread should do rest of the thing in your while loop. other thread is responsible to sleep for specific time and on resume of sleep, should call your specific function
21st Sep 2019, 6:16 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Can you provide an example
21st Sep 2019, 6:18 AM
Saksham Narula
Saksham Narula - avatar