0

C++ PAUSE

Is there a way to make a block of code waiting before it will be executed, for example a library? How to use it? I tried with __TIME__ variable but once the code is written and executed the first time the value of __TIME__ is the same every time I execute it.

19th Jun 2018, 11:37 AM
OrHy3
OrHy3 - avatar
5 odpowiedzi
+ 1
__TIME__ is a string litral containing the time of compilation in the form of hh:mm:ss. You can't use it for that problem. system("PAUSE"); works on Windows only so it'll make the code platform dependent. Emulating the effect of pause by wasting CPU time through using a loop is an inefficient way to work around the problem but it doesnt work on SL. Also using cin.get() would be another trick. I can't think of any other way to work around the problem.
19th Jun 2018, 12:40 PM
To Seek Glory in Battle is Glorious
To Seek Glory in Battle is Glorious - avatar
19th Jun 2018, 12:28 PM
Daljeet Singh
Daljeet Singh - avatar
0
OrHy3 What must wait your program? Static libraries are linked to compile time (hence no wait in execution)... Can you say what your program must wait?
19th Jun 2018, 1:11 PM
KrOW
KrOW - avatar
0
I 've already found the answers thanks to Daljeet Singh. KrOW, I mean programs that need to wait a certain number of seconds, such as a timer
19th Jun 2018, 1:21 PM
OrHy3
OrHy3 - avatar
0
OrHy3 Ok.... Because you have found a solution, would it good if you mark Daljeet Singh like best answer for future readers
19th Jun 2018, 1:22 PM
KrOW
KrOW - avatar