mkstemp

mkstemp

In computing, mkstemp is a POSIX function for creating a temporary file, a computer file which ceases to exist when the program, which opened the file, closes it or terminates.[1]

Contents

Usage

Inclusion

C
#include <stdlib.h> // per IEEE Std 1003.1, 2004
#include <unistd.h> // for "legacy" systems
C++
#include <cstdlib>  // per IEEE Std 1003.1, 2004
#include <unistd.h> // for "legacy" systems

Declaration

int mkstemp(char* template);

Requirements

  • The parameter template must be a modifiable, null-terminated character array.
  • The contents of template must be in the format of a valid file path, with six trailing 'X's.
  • The parameter template must not have been used in a previous invocation of mkstemp.

Semantics

  • The trailing 'X's in template are overwritten to generate a unique file name for the resulting temporary file.
  • The function reports a valid file descriptor to a temporary file on success; on failure, it reports -1.

Error conditions

It is unspecified if mkstemp sets errno, and what values of errno are set, in the event of failure.[1]

References

  1. ^ a b mkstemp by OpenGroup

See also


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Mkstemp — In computing, mkstemp is an UNIX function for creating a temporary file, a computer file which ceases to exist when the program, which opened the file, closes it or terminates. [http://www.opengroup.org/onlinepubs/009695399/functions/mkstemp.html …   Wikipedia

  • Tmpfile — In computing, tmpfile is an ISO C/POSIX function for creating a temporary file, a computer file which ceases to exist when the program, which opened the file, closes it or terminates. [http://www.opengroup.org/onlinepubs/009695399/functions/tmpfil… …   Wikipedia

  • Symlink race — A symlink race is a kind of software security vulnerability that results from a program creating files in an insecure manner. A malicious user can create a symbolic link to a file not otherwise accessible to him or her. When the privileged… …   Wikipedia

  • Circular buffer — A ring showing, conceptually, a circular buffer. This visually shows that the buffer has no real end and it can loop around the buffer. However, since memory is never physically created as a ring, a linear representation is generally used as is… …   Wikipedia

  • Symlink-Schwachstelle — Eine Symlink Schwachstelle (auch symlink vulnerability) ist eine Sicherheitslücke, die es einem Angreifer erlaubt, beliebige Dateien mit den Rechten des ausgeführten Programmes zu schreiben. Diese Lücke entsteht, wenn ein Programm mit erweiterten …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”