#include <stdio.h>
int main ()
{
char buffer[L_tmpnam];
char *ptr;
char *ptr2;
ptr2 = tmpnam(buffer);
ptr = tmpnam(NULL);
if ( ptr == NULL || ptr2 == NULL )
{
fputs( "Failed to generate temporary file name", stderr );
return -1;
}
printf("Temporary name 1: %s\n", buffer);
printf("Temporary name 2: %s\n", ptr);
return(0);
}
Categories: C language
515 Comments