Search code examples
c++xcodemacos-sierra

On Xcode (mac api) is there any file with a Sleep() function/command?


I coded a rpg on a school computer with a whole bunch of Sleep() functions in it and now when I come home I want to play it but I have a mac and Windows.h is not included in the api. Please help


Solution

  • Use C++11 thread.

    #include <thread>
    
    std::this_thread::sleep_for(std::chrono::milliseconds(10));