I am using a Windows app for Ubuntu to practice C/C++ code.
Eventually I found that sleep() call does not work here. I went through the answers provided earlier on other posts but could not find any relevant solution for it.
So I just want to know whether there is any way to make sleep() or a similar kind of waiting call to work on same Ubuntu application?
Example code:
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<signal.h>void handler(int num){ write(STDOUT_FILENO, "I am in handler...handling signal\n", 13);}int main(int argc, char **argv){ signal(SIGINT, handler); signal(SIGTERM,handler); while(1) { printf("Just wasting your time! PID = %d\n", getpid()); sleep(1); }}