Tmpfile

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/tmpfile.html tmpfile] by OpenGroup] [ [http://www.gnu.org/software/libtool/manual/libc/Temporary-Files.html Temporary Files] by GNU C Library] [ [http://www.hmug.org/man/3/tmpfile.php tmpfile] by HMUG]

Usage

Inclusion

; C#include ; C++#include

Declaration

FILE* tmpfile(void);

emantics

The function tmpfile reports a pointer to a valid file stream on success; on failure, it returns NULL.

Error conditions

In addition to returning NULL, tmpfile sets errno on failure. The permissible values of errno, if tmpfile fails, are:
*EINTR - if a signal was caught during the execution of tmpfile.
*EMFILE - if the maximum number of file descriptors and/or the maximum number of file streams has been reached (in the process).
*ENFILE - if the maximum allowable number of files is currently open (in the system).
*ENOSPC - if there is no space in the file system for creating the temporary file.
*EOVERFLOW - if the file is a regular file and the size of the file cannot be represented correctly in an object of type off_t.
*ENOMEM - if there is insufficient memory for allocating the file stream.

Caveats

The tmpfile function is susceptible to a number of security vulnerabilities; use the non-portable mkstemp (UNIX) or tmpfile_s (Windows) functions, instead, to avoid these issues. [ [https://buildsecurityin.us-cert.gov/daisy/bsi-rules/home/g1/861-BSI.html TMPNAM-TMPFILE Vulnerability] by Build Security In] [https://www.securecoding.cert.org/confluence/display/seccode/VOID+FI039-C.+Create+temporary+files+securely VOID FI039-C. Create temporary files securely] by CERT]

References

ee also

*mkstemp
*fopen
*fclose
*stdio.h


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Compression virus — is an example of a benevolent Computer virus invented by Fred Cohen. It searches for an uninfected executable file, compresses the file and prepends itself to it. The virus can be described in pseudo code [1] program compression virus:=… …   Wikipedia

  • C file input/output — C Standard Library Data types Character classification Strings Mathematics File input/output Date/time Localiza …   Wikipedia

  • Les Norman (politician) — Leslie George Norman (3 September 1913 ndash;5 July 1997) was an Australian politician. Norman represented Glen Iris in the Victorian Legislative Assembly for four years, and led the Liberal Country Party from 1951 ndash;1952. Norman was a… …   Wikipedia

  • List of C functions — This page aims to alphabetically list all the predefined functions used in the C standard library, and a few of the non standard functions. * assert.h ** (no functions) * ctype.h ** (non standard) digittoint ** isalnum ** isalpha ** (non… …   Wikipedia

  • 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

  • Lehrberg — Wappen Deutschlandkarte …   Deutsch Wikipedia

  • Stdio.h — Saltar a navegación, búsqueda stdio.h, que significa standard input output header (cabecera estandar E/S), es la biblioteca estándar del lenguaje de programación C, el archivo de cabecera que contiene las definiciones de macros, las constantes,… …   Wikipedia Español

  • Funciones de la biblioteca estándar de C — Anexo:Funciones de la biblioteca estándar de C Saltar a navegación, búsqueda El propósito de este artículo es proporcionar un listado alfabético de todas las funciones de la biblioteca estándar de C, y unas pocas funciones no estándar. Contenido… …   Wikipedia Español

  • Stdio.h — Стандартная библиотека языка программирования С assert.h complex.h ctype.h errno.h fenv.h float.h inttypes.h iso646.h limits.h locale.h math.h setjmp.h signal.h stdarg.h stdbool.h stddef.h stdint.h stdio.h stdlib.h …   Википедия

  • Список функций стандартной библиотеки Си — В этой статье в алфавитном порядке перечислены все предопределенные функции, используемые в стандартной библиотеке Си, а также несколько нестандартных функций. assert.h (нет функций) ctype.h (нестандартная) digittoint isalnum isalpha… …   Википедия

Share the article and excerpts

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