How do I make the daemon function starts other current directory. And send standard input/ouput to file?
The man page for daemon is as follow:
Code:
int daemon(int nochdir, int noclose);
Unless the argument nochdir is non-zero, daemon() changes the current
working directory to the root ("/").
Unless the argument noclose is non-zero, daemon() will redirect stan-
dard input, standard output and standard error to /dev/null.