Here is my code :
char *name, name_log=\"log-\";
------getting \'name\' from user-----
strcat(name_log, name);
char ext[] =
string literals get allocated a fixed amount of memory, generally in a read only section, you instead need to use a buffer.
char buffer[64] = "log-";
strncat(buffer,".log",32);
On a side note, strcat is generally unsafe, you need to use something that that checks the size of the buffer it uses or with limits on what it can concatenate, like strncat.