lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: freopen -- the easy way (was: Re: LYNX-DEV 4DOS)


From: Laura Eaves
Subject: Re: freopen -- the easy way (was: Re: LYNX-DEV 4DOS)
Date: Thu, 8 May 1997 05:28:41 -0400 (EDT)

Ok, duhhhh, I know i shouldn't have done this in the middleo  the night...

The access code didn't work (of course) when the file name was a directory.
But there is a much easier way -- let stdio do it all for you...
Sorry for the verbage...

            char* filename = whatever;
            FILE* fd = fopen(filename,"a+");
            printf("checking \"%s\"\n",filename);
            if ( fd != NULL ) {
                printf("freopen(\"%s\",\"a+\",stderr)\n",filename);
                fclose(fd);
                fd = freopen(filename,"a+",stderr);
                if ( fd == NULL ) {
                    printf("%s: FAILED TO REOPEN STDERR!!!\n",filename);
                    /* exit(1); */
                } else
                    fprintf(stderr,"testing %s\n",filename);
            }
--le

;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]