How can I sleep or pause the program excecution by a few seconds in C? I'm looking for something like this that is used in Java:
Thread.sleep(interval);
Is possible do this using C ? Thanks in advance.
How can I sleep or pause the program excecution by a few seconds in C? I'm looking for something like this that is used in Java:
Thread.sleep(interval);
Is possible do this using C ? Thanks in advance.
#include <stdio.h>
#include <unistd.h>
int main (void){
sleep(3);
return 0;
}
Read more here.
There is an answer here: What is the proper #include for the function 'sleep' in C?
Be careful that it works differently in Unix and Windows, whereas in one is measured in millisecs and in the other in secs.