Re: Temporarily close stdout?
- From: Joakim Hove <joakim.hove@xxxxxxxxx>
- Date: Wed, 30 Apr 2008 06:31:03 -0700 (PDT)
Thank you for answering.
[I have looked at the dup/dup2 calls, I agree that these seem to be
useful for me, but those man-pages are just above my limit I am
afraid.]
It looks as if you're using something Posix-like.
That is right.
But closing stdout is dubious in the first place. Are you sure the
library won't complain about stdout being closed?
Yes - I was also uncomfortable with that. I had no strong will to
close() stdout, it was merely a suggestion on my behalf.
It would be better to freopen() stdout to /dev/null.
I have tried:
....
/* Temporarily redirect stdout -> /dev/null */
stdout = freopen("/dev/null" , "w" , stdout);
/* Offending call */
lsb_submit( &request , &reply );
/* restore stdout */
stdout = freopen("/dev/stdout" , "w" , stdout);
But - the last freopen() fails with 2:No such file or directory.
Suggestions?
Joakim
.
- Follow-Ups:
- Re: Temporarily close stdout?
- From: Richard Tobin
- Re: Temporarily close stdout?
- References:
- Temporarily close stdout?
- From: Joakim Hove
- Re: Temporarily close stdout?
- From: Richard Tobin
- Temporarily close stdout?
- Prev by Date: Re: Is cast operator unary or binary? How many operands?
- Next by Date: Doubt about array's name
- Previous by thread: Re: Temporarily close stdout?
- Next by thread: Re: Temporarily close stdout?
- Index(es):
Relevant Pages
|