Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Tem****arily cl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 25983 of 27343
Post > Topic >>

Tem****arily close stdout?

by Joakim Hove <joakim.hove@[EMAIL PROTECTED] > Apr 30, 2008 at 05:36 AM

[ This question is about closing/reopening/... of stdout - I hope that
is on topic?]

Hello,

I have written a program in C; this programs uses an external
proprietary library. When calling a certain function in the external
library, the particular function writes a message to stdout. I am not
particularly interested in this message, and would like to silence it
- however I do not know how to do it. (I stdout and stderr my self, so
just redirecting into oblivion is not an option).

An excerpt of the code looks like this:


   ....
  /* Offending call in external library. */
  job_nr = lsb_submit( &request , &reply);


When this code is run - the offending function (or some function it
calls), writes
"Job <123456> is submitted to queue <common>"

An information I am completely uninterested in sending stdout. So I
wondered if it would be possible to do something like this:


   ....
   /* Tem****arily close stdout: */
   fclose(stdout);
   job_nr = lsb_submit( &request , &reply );
   /* Reopen stdout */
   stdout = fdopen(1 , "a");

I have tried the code listed above - but the fdopen() failed with "Bad
file descriptor" (I had not expected it to succeed ...). Anyway - any
suggestions would be highly appreciated.


Joakim
 




 6 Posts in Topic:
Temporarily close stdout?
Joakim Hove <joakim.ho  2008-04-30 05:36:02 
Re: Temporarily close stdout?
Willem <willem@[EMAIL   2008-04-30 12:41:24 
Re: Temporarily close stdout?
richard@[EMAIL PROTECTED]  2008-04-30 13:07:05 
Re: Temporarily close stdout?
Joakim Hove <joakim.ho  2008-04-30 06:31:03 
Re: Temporarily close stdout?
richard@[EMAIL PROTECTED]  2008-04-30 13:56:05 
Re: Temporarily close stdout?
Joakim Hove <joakim.ho  2008-04-30 07:07:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Sep 6 21:26:41 CDT 2008.