Ya u r rite i have one boolean check like this
Code:
#define TERMINALMASK 0 or 1
int main ()
{
if (TERMINALMASK == SET)
{
fd = open("/dev/null", O_RDWR);
dup2(fd,0);
dup2(fd,1);
dup2(fd,2);
close(fd);
}
else
{
/*do nothing*/
}
whiel(1)
{
When i get message from other process or i get user input to change file content
{
open a file
read file
write file
printf("success");
close file;
}
}
return 0;
}
This is sample code.
i want to run my process like deamon. The user should not know weather it is running or not.
So if i assign output and error fd to /dev/null it wont create problem.
I want to know is it proper to assign input fd to /dev/null?