You are not logged in.
Pages: 1
Hello!
I'm working on some kind of UNIX daemon in C++. My server isn't a regular daemon (it's not launched by init process but by normal users (mostly) in their X sessions), so it share so similarities with unix daemons.
I have problem with initializing my daemon. Usually in child processes created by fork() we close all standard I/O streams (stdout, stdin, stderr). I how to do it with C library, but I'm not sure what to do with I/O streams from standard C++ library.
I don't know how to close cin, cout, clog and cerr streams...
Offline
You don't need to care about the higher-level streams, anymore than you need to
care about the stdio FILE pointers in plain C... Just close the low-level file descriptors,
and/or reopen "/dev/null" on top of them, the same as you would in C...
Offline
Pages: 1