fnm -- Return Filename

SYNOPSIS
#include <lcio.h>
char *fnm(FILE *f);
DESCRIPTION
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.
RETURN VALUE
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.
EXAMPLE
This example uses 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. ");
}
SEE ALSO