[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: freopen -- the easy way (was: Re: LYNX-DEV 4DOS)
From: |
Kari E. Hurtta |
Subject: |
Re: freopen -- the easy way (was: Re: LYNX-DEV 4DOS) |
Date: |
Thu, 8 May 1997 20:22:41 +0300 (EDT) |
Larry W. Virden, x2487:
> To handle the case of the freopen failing, you might be able to use
> something like
> int oldstderrfd;
> FILE *newstderr;
>
> if ((oldstderrfd = dup(fileno(stderr))) != -1 ) {
> /* Do your code to do the freopen of stderr, etc.) */
> }
>
> /* Now, when it's time to go back ... */
> if ( (stderr = fdopen(oldstderr,"w+") ) != NULL ) {
> /* stderr should be back to where it was */
> }
You can't do that. Notice following:
#define stderr (&__iob[2])
[That is from stdio.h of IRIX]
(&__iob[2]) can't be in left side of assigment.
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;