_rmtmp

From RAD Studio
Jump to: navigation, search

Go Up to stdio.h Index


Header File

stdio.h

Category

Input/output Routines

Prototype

int _rmtmp(void);

Description

Removes temporary files.

The _rmtmp function closes and deletes all open temporary file streams which were previously created with tmpfile. The current directory must the same as when the files were created, or the files will not be deleted.

Return Value

_rmtmp returns the total number of temporary files it closed and deleted.

Example

#include <stdio.h>
#include <process.h>

void main()
{
   FILE *stream;
   int i;

   /* Create temporary files */
   for (i = 1; i <= 10; i++)
   {
     if ((stream = tmpfile()) == NULL)
       perror("Could not open temporary file\n");
     else
       printf("Temporary file %d created\n", i);
   }
   /* Remove temporary files */
   if (stream != NULL)
     printf("%d temporary files deleted\n", rmtmp());
}
  

Portability

POSIX Win32 ANSI C ANSI C++

+