C Tutorial/stdio.h/tmpfile — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Версия 17:21, 25 мая 2010

tmpfile

Item Value Header file stdio.h Declaration FILE *tmpfile(void); Function opens a temporary binary file for read/write operations and returns a pointer to the stream. Return returns a null pointer on failure.

The temporary file created by tmpfile() is automatically removed when the file is closed or when the program terminates.

You can open TMP_MAX temporary files (up to the limit set by FOPEN_MAX).


<source lang="cpp">#include <stdio.h> int main(void){

 FILE *temp;
 if((temp=tmpfile())==NULL) {
   printf("Cannot open temporary work file.\n");
   exit(1);
 }

}</source>