codescracker


c

C tmpfile()



« Previous Function Next Function »


tmpfile()

The tmpfile() function opens a temporary binary file for the read/write operations and returns a pointer to the stream. The function automatically uses a unique filename to avoid conflicts with existing files.

tmpfile() Syntax

#include<stdio.h>
FILE *tmpfile(void);

The tmpfile() returns a null pointer on failure, otherwise returns a pointer to the stream

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

tmpfile() Example

Following c code creates a temporary working file:

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

« Previous Function Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test