Joe said:
Can i redirect stdout and stderr to somthing NULL. If yes, how?
Like you have already been told, try a newsgroup dedicated to your
operating system (comp.unix.programmer). We only deal with standard c
here and standard c knows nothing about stdout or stderr redirection. [...]
<OT>
Call fclose() on stdout and stderr from within the child pid when you
fork().
</OT>
[...]
Causing "bad things"[tm] to happen. Any printf()/sprintf(stderr) will
now cause undefined behavior. And, perhaps worse, the next fopen() may
return the same FILE* as was previously occupied by stdout/stderr, and
writing to stdout/stderr will now go to the fopen()ed file.
On the other hand, your platform may have the ability to freopen stdout
and stderr to a bit-bucket, such as Unix's "/dev/null".
Check a group related to your O/S for more details.
--
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody |
www.hvcomputer.com | |
| kenbrody/at\spamcop.net |
www.fptech.com | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+
Don't e-mail me at: <mailto:
[email protected]>