I'm saving data in two different file and using strcat to concatenate these data.
Strangely, the result of my last strcat call get concat to the two string I want to concat now.
It might be a bit blurry so here is the code :

```
...
strcat(logline,"\n");
if(logging){
    if(writeInFile(logfile,"a",logline))
         printf("    Connection logged.");
    else
         printf("    Connection couldn't be logged.");        
}

if(saving){
    char* loc = (char*) malloc(BUFSIZ);
    strcat(loc,client_ip);
    strcat(loc,"-");
    strcat(loc,server_ip);
    strcat(loc,".txt");

    if(writeInFile(loc,"a",request)){
          printf("    Connection saved.");
    }
    else{
          printf("ERROR: cannot create/open savefile %s\n",loc);
          printf("Saving set to FALSE.");
          saving = false;
    }
}

```

```
bool writeInFile(char* fileName, char* openingParam, char* content){
    if(strcmp(openingParam,"a") == 0 || strcmp(openingParam,"w") == 0){
        FILE* fptr = NULL;
        fptr = fopen(fileName,openingParam);
        if ( fptr == NULL)
        {
            printf("ERROR: cannot create/open logfile %s\n",fileName);
            return false;
        }
        fprintf(fptr,"%s",content);
        fclose(fptr);
        return true;
    }

    return false;
}

```

What's happening is that the content of logline is put at the start of loc.
So a file with a hell long name is created.

EDIT :: The file is supposed to be named like 192.168.1.36-192.168.1.36.txt

but is instead named like

```
|--> timestamp = Sat Jan  2 20:09:24 2021
|--> remote    = 192.168.1.36
|--> local     = 192.168.1.36
|--> request   = [timeout]
|--> END
192.168.1.36-192.168.1.36.txt

```

```
|--> timestamp = Sat Jan  2 20:09:24 2021
|--> remote    = 192.168.1.36
|--> local     = 192.168.1.36
|--> request   = [timeout]
|--> END

```

Being the value of logline obtained via strcat.