#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); 
}

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *