On this page
  1. tmpfile
  2. Include
  3. Signature & Overview
  4. Notes & Pitfalls
  5. Example

tmpfile

Prev: setvbuf | Up: stdio.h | Next: sprintf
Rel: stdio.h, stdio.h & File I/O Guide
Ref: cppreference — tmpfile
Tags: #public #prog #c #stdlib #stdio #tier/specialized


Include

#include <stdio.h>

Signature & Overview

FILE *tmpfile(void);

Creates and opens a unique binary temporary file ("wb+") that is automatically deleted on close or normal exit.

Notes & Pitfalls

Example

#include <assert.h>
#include <stdio.h>

int main(void) {
    FILE *f = tmpfile();
    assert(f != NULL);
    fclose(f);
}

Linked from

Related notes