Simple usage:
#include <unistd.h>
#include <iostream>
int main()
{
std::cout << usleep(20 * 1000) << std::endl;
return 0;
}
Compiled with g++ main.cpp
. The executable exit immediately printing 0
indicate no error is detected. So what is wrong?