This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/tempnam.c

27 lines
502 B
C

#include <stdio.h>
#include <stdlib.h>
/*
Environment variable TMP=C:\WINDOWS\TEMP
*/
void main()
{
char *filename;
FILE *fp;
filename = _tempnam( "D:\\TEMP", "_T" );
if( filename == NULL )
printf( "Can't obtain temp file name\n" );
else {
printf( "Temp file name is %s\n", filename );
fp = fopen( filename, "w+b" );
/* . */
/* . */
/* . */
fclose( fp );
remove( filename );
free( filename );
}
}