Wait/Pause an amount of seconds in C

前端 未结 3 825
温柔的废话
温柔的废话 2021-01-11 12:33

I wrote a little console application, and I want it to pause for a certain number of seconds before the cycle (a while) starts again.

I\'m working on Windows operati

3条回答
  •  感情败类
    2021-01-11 13:09

    On UNIX:

    #include 
    sleep(10); // 10 seconds
    

    On Windows:

    #include 
    Sleep(10000); // 10 seconds (10000 milliseconds)
    

    Note the difference between sleep() (UNIX) and Sleep() (Windows).

提交回复
热议问题