Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

unlink(2)

fopen(3)

mktemp(3)

perror(3)

stdio(3)

tmpnam(3)



  tmpfile(3)                          CLIX                          tmpfile(3)



  NAME

    tmpfile - Creates a temporary file

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

    #include <stdio.h>

    FILE *tmpfile(
      void );

  DESCRIPTION

    The tmpfile() function creates a temporary file using a name generated by
    tmpnam(), and returns a corresponding pointer.  If the file cannot be
    opened, an error message is printed using perror(), and a pointer is
    returned.  The file will automatically be deleted when the process using
    it terminates.  The file is opened for update (``w+'').

  EXAMPLES

    To create a temporary file:

    #include <stdio.h>

    main()
    {
         FILE *tmpfile = tmpfile();
         char *text = "This is a test string.";
         char *teststring;
         fprintf(tmpfile, "%s", *text);
         fscanf(tmpfile, "%s", teststring);
         if (teststring)
              printf("tmpfile worked");
         else
              printf("tmpfile failed");
    }


  RETURN VALUES

    The tmpfile() function returns a pointer to the tmpfile created.

  RELATED INFORMATION

    Functions:  creat(2), unlink(2), fopen(3), mktemp(3), perror(3), stdio(3),
    tmpnam(3)



  2/94 - Intergraph Corporation                                              1




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026