[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
tmpfile

Open a temporary file.
Compatibility:
This function is compatible with the following targets:
Prototype:
#include <stdio.h>
FILE *tmpfile(void);
Remarks:
The tmpfile() function creates and opens a binary file that is automatically removed when it is closed or when the program terminates.
Return:
tmpfile() returns a pointer to the FILE variable of the temporary file if it is successful. If it fails, tmpfile() returns a null pointer (NULL).
See Also:
"fopen"
"tmpnam"
Example of tmpfile() usage.:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
FILE *f;
// create a new temporary file for output
if ( (f = tmpfile()) == NULL) {
printf("Can't open temporary file.\n");
exit(1);
}
// output text to the temporary file
fprintf(f, "watch clock timer glue\n");
// close AND DELETE the temporary file
// using fclose()
fclose(f);
return 0;
}
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000