freopen - no file name available
Doug Gwyn
gwyn at smoke.BRL.MIL
Mon Sep 25 11:33:40 AEST 1989
In article <206 at vsserv.scri.fsu.edu> nall at loligo.cc.fsu.edu (John Nall) writes:
>If one uses freopen to temporarily use a file for which only the
>stream pointer is available (freopen(filename,access,FILE *)
>is there any way to subsequently use freopen to go BACK to using
>the original stream? (This can probably be rephrased as "is there
>a way to go from a stream pointer to the original file name").
I don't understand your first clause -- freopen() CLOSES the open
stream, then reuses its data area for the new stream that it opens
by name.
On UNIX, you could first dup(fileno(fp)) and later use fdopen() to
reassociate another stdio stream with the file handle, without
having to know how to open it by name (assuming it even had a name).
More information about the Comp.unix.questions
mailing list