>: In my program, I need to temporrarily disable the stderr.
>: the reason is when I call a purchased library function, it always
>: dumps a message "Not for Resale" to stderr. I wonder how I can
>: disable the stderr before I call that function and then enable
>: it later?
> stderr is just a file descriptor that you should just be able
>to close just like any other file descriptor. As far as reopening it
>after it's been closed, I'm not sure -- you probably won't be able to,
>since it's a constant (and opening it would try to redefine it).
The correct thing to do here is to use either the 'dup' or 'dup2' system
calls, to make a second copy of file descriptor 2. You can then close
filedescriptor 2, make the call to the library, and then use 'fdopen'
to reestablish the connection.
stderr is NOT a constant, it might be a constant pointer.