#include <lcio.h> char *fnm(FILE *f);
fnm
returns the filename for the stream associated with the FILE
object addressed by f
. The filename can be saved and used later to
reopen the file.
fnm
returns the name of the external file associated with f
. If
f
does not identify an open stream, the effect of calling fnm
is
unpredictable.
fnm
to name the file used for stdout
:
#include <lcio.h> #include <stdio.h> main() { printf("File name associated with stdout is %sn", fnm(stdout)); /* Try to open stdout as a binary stream. */ if (!freopen(fnm(stdout), "wb", stdout)) fputs("Unable to reopen stdout.n", stderr); else puts("stdout has now been opened in binary mode. "); }
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.