Demonstration of temporary filenames. - C File

C examples for File:File Operation

Description

Demonstration of temporary filenames.

Demo Code

#include <stdio.h>

int main( void )
{
    char buffer[10], *c;

    /* Get a temporary name in the defined buffer. */

    tmpnam(buffer);//from   w ww .jav  a 2 s  .  c  o  m

    /* Get another name, this time in the function's */
    /* internal buffer. */

    c = tmpnam(NULL);

    /* Display the names. */
    printf("Temporary name 1: %s", buffer);
    printf("\nTemporary name 2: %s\n", c);
    return 0;
}

Result


Related Tutorials