Unique String generator
<p>I want to make a program (network server-client).
One of the specification for this program is next: </p>

<p>The server will receive the sent packages and save it into a file, with a unique name (generated by the server at the moment the transfer starts.
Ex __tf_"unique_random_string".txt</p>

<p>I made a function that returns a pointer to a "unique" string created. </p>

<p>The problem is: If i stop the server and then start it again it will generate the same names.</p>

<p>Ex:this file names were generated and then i stopped the server.</p>

<p>__ft_apqfwk.txt</p>

<p>__ft_arzowk.txt</p>

<p>__ft_cdyggx.txt</p>

<p>I start it again and i try to generate 3 file names. Them will be the same.</p>

<p>Sorry for my english. I'm still learning it.</p>

<p>My function to generate this "unique string" is:</p>

<pre><code>char *create_random_name(void)
{
    const char charset[] = "abcdefghijklmnopqrstuvwxyz";
    char *file_name;
    int i=0;
    int key;
    if((file_name = malloc(16 * sizeof ( char )) ) == NULL)
    {
        printf("Failed to alloc memory space\n");
        return NULL;
    }
    strcpy(file_name,"__ft_");
    for(i=5 ; i&lt;11 ; i++)
    {
        key = rand() % (int)(sizeof(charset)-1);
        file_name[i]=charset[key];
    }
    strcat(file_name,".txt");
    file_name[15] = '\0';
    return file_name;
}
</code></pre>