Back to index

glibc  2.9
tmpfile.c File Reference
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


FILEtmpfile (void)

Function Documentation

FILE* tmpfile ( void  )

Definition at line 39 of file tmpfile.c.

  char buf[FILENAME_MAX];
  int fd;
  FILE *f;

  if (__path_search (buf, FILENAME_MAX, NULL, "tmpf", 0))
    return NULL;
  int flags = 0;
#ifdef FLAGS
  flags = FLAGS;
  fd = __gen_tempname (buf, flags, __GT_FILE);
  if (fd < 0)
    return NULL;

  /* Note that this relies on the Unix semantics that
     a file is not really removed until it is closed.  */
  (void) __unlink (buf);

  if ((f = __fdopen (fd, "w+b")) == NULL)
    __close (fd);

  return f;

Here is the call graph for this function: