Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.development.apps > #299
| From | Rainer Weikusat <rweikusat@mssgmbh.com> |
|---|---|
| Newsgroups | comp.os.linux.development.apps |
| Subject | Re: How to dup a FILE* |
| Date | 2011-12-06 20:38 +0000 |
| Message-ID | <8762hto2p4.fsf@sapphire.mobileactivedefense.com> (permalink) |
| References | <jbkl2v$a75$1@nntp.ts.fujitsu.com> <20111206195333.49dd7a9d@dwnoon.ntlworld.com> |
David W Noon <dwnoon@spamtrap.ntlworld.com> writes: > On Tue, 06 Dec 2011 09:51:43 +0100, Josef Moellers wrote about How to > dup a FILE*: > >>I need to juggle with stderr: redirecting it from one file to another >>and back. > [snip] > > I think you're over-complicating things here. After all, stderr is > simply a pointer. So, cache the old pointer; open a new file stream > stored in stderr; fclose(stderr) when done; reinstate the original > pointer. That's a thoroughly stupid idea because it won't affect output to 'standard error filedescriptor' which doesn't go through the stderr stream *and* while the glibc documentation claims that this should work, it actually doesn't (or at least didn't for some random version where I tried this about ten years ago -- only to be told that I "should use freopen instead" by Ulrich Drepper [which I couldn't do because I was trying to divert the output to a socket]).
Back to comp.os.linux.development.apps | Previous | Next — Previous in thread | Next in thread | Find similar
How to dup a FILE* Josef Moellers <josef.moellers@ts.fujitsu.com> - 2011-12-06 09:51 +0100
Re: How to dup a FILE* Richard Kettlewell <rjk@greenend.org.uk> - 2011-12-06 09:16 +0000
Re: How to dup a FILE* Josef Moellers <josef.moellers@ts.fujitsu.com> - 2011-12-06 10:41 +0100
Re: How to dup a FILE* Jasen Betts <jasen@xnet.co.nz> - 2011-12-06 13:28 +0000
Re: How to dup a FILE* Josef Moellers <josef.moellers@ts.fujitsu.com> - 2011-12-06 16:57 +0100
Re: How to dup a FILE* David W Noon <dwnoon@spamtrap.ntlworld.com> - 2011-12-06 19:53 +0000
Re: How to dup a FILE* Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-12-06 20:38 +0000
Re: How to dup a FILE* Richard Kettlewell <rjk@greenend.org.uk> - 2011-12-06 22:03 +0000
Re: How to dup a FILE* David W Noon <dwnoon@spamtrap.ntlworld.com> - 2011-12-06 21:46 +0000
Re: How to dup a FILE* Rainer Weikusat <rweikusat@mssgmbh.com> - 2011-12-07 17:52 +0000
csiph-web