Detach from controlling tty in daemon process

How can I detach from the controlling tty in a daemon process, in C?
gumby119Asked:
Who is Participating?
 
davidmwilliamsConnect With a Mentor Commented:
 The answer is to use ioctl, like this -

        int fd;
        fd = open ("/dev/tty", O_RDWR);
        ioctl (fd, TIOCNOTTY, 0);
        close (fd);

  This will do exactly what you want.
0
 
gumby119Author Commented:
That certainly did the trick !!!  Thanks !  And so quick - within minutes!  This service is great!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.