while(1)
{
sleep(10);
if(kbhit())
printf("you press keyboard");
}
i try to know wheter the kbhit() working or not by do that, but after i compile it then i type something in...
Type: Posts; User: wiraredi
while(1)
{
sleep(10);
if(kbhit())
printf("you press keyboard");
}
i try to know wheter the kbhit() working or not by do that, but after i compile it then i type something in...
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
int kbhit(void)
{
struct termios oldt, newt;
while(1)
{
if(kbhit())
{
exit(0);
}
}
and it is could not stop the child process, how do i make the child process exit ??
i want to make a daemon process that could stop if user hit the keyboard, but the kbhit routine doesnt work when it is in the daemon process, would you help please?
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
int kbhit(void)
{
struct termios oldt, newt;