Sleep function in C++

后端 未结 7 1665
情书的邮戳
情书的邮戳 2020-11-27 03:27

Is there a function like Sleep(time); that pauses the program for X milliseconds, but in C++?

Which header should I add and what is the function\'s sign

7条回答
  •  萌比男神i
    2020-11-27 03:30

    On Unix, include #include .

    The call you're interested in is usleep(). Which takes microseconds, so you should multiply your millisecond value by 1000 and pass the result to usleep().

提交回复
热议问题