Chapter Contents

Previous

Next
fnm

fnm



Return Filename

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE
SEE ALSO


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 %s\n", 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


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.