Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the proper #include for the function 'sleep()'?

Tags:

c

posix

sleep

People also ask

What is proper explain with example?

countable noun. A proper noun is the name of a particular person, place, organization, or thing. Proper nouns begin with a capital letter. Examples are ' Margaret', ' London', and 'the United Nations'. Compare common noun.

What is this word proper?

1 : correct according to social or moral rules proper behavior. 2 : appropriate entry 1, suitable Use the proper tool for the job. 3 : strictly accurate : correct "… do everything in the proper order … and I'm sure all will be well."—

What is use proper?

PROPER function takes just one argument, text, which can be a text value or cell reference. PROPER first lowercases any uppercase letters, then capitalizes each word in the provided text string. Numbers, punctuation, and spaces are not affected. PROPER will convert numbers to text with number formatting removed.

Where is your proper means?

It's an important part of your identity. So people ask, where are you from, and then, "Where are you from, proper." As in, really, actually, properly. So it means, "Where are you from, actually" - This has slowly decayed into "What's your Proper."


The sleep man page says it is declared in <unistd.h>.

Synopsis:

#include <unistd.h>

unsigned int sleep(unsigned int seconds);


sleep is a non-standard function.

  • On UNIX, you shall include <unistd.h>.
  • On MS-Windows, Sleep is rather from <windows.h>.

In every case, check the documentation.


this is what I use for a cross-platform code:

#ifdef _WIN32
#include <Windows.h>
#else
#include <unistd.h>
#endif

int main()
{
  pollingDelay = 100
  //do stuff

  //sleep:
  #ifdef _WIN32
  Sleep(pollingDelay);
  #else
  usleep(pollingDelay*1000);  /* sleep for 100 milliSeconds */
  #endif

  //do stuff again
  return 0;
}

What is the proper #include for the function 'sleep()'?

sleep() isn't Standard C, but POSIX so it should be:

#include <unistd.h>

sleep(3) is in unistd.h, not stdlib.h. Type man 3 sleep on your command line to confirm for your machine, but I presume you're on a Mac since you're learning Objective-C, and on a Mac, you need unistd.h.