title: strncat adds some unexpected characters
body: <p>I'm trying to read files from a directory and to write some informations in "corresponding" files in an other directory. And to get the path and names to new files I concatenate some string using strncat function.
  My problem is, strncat add somes characters at the begining of some strings, and I don't understand what I'm doing wrong.</p>
  
  <p>Here is my code :</p>
  
  <pre><code>#define TRACES "../traces3/"
  #define CSV "../csv/"
  
  FILE* trace;
  FILE* unite;
  FILE* dizaine;
  
  // Ouvre les fichiers de trace et de résultats
  void ouverture (char* nom) {
      char* nTra;
      char* nUni;
      char* nDiz;
  printf ("%s\n", CSV);
  
      nTra=malloc ((strlen (TRACES)+strlen (nom)+30)*sizeof (char));
      if (nTra==NULL) {
          printf ("Une erreure est survnue lors d'une allocation mémoire\n");
          perror ("malloc");
          exit (0);
      }
      strncat (nTra, TRACES, strlen (TRACES));
  printf ("nTra : %s\n", nTra);
      strncat (nTra, nom, strlen (nom));
  
  printf ("nTra : %s\n", nTra);
  
      nUni=malloc ((strlen (CSV)+strlen (nom)+30)*sizeof (char));
      if (nUni==NULL) {
          printf ("Une erreure est survnue lors d'une allocation mémoire\n");
          perror ("malloc");
          exit (0);
      }
      strncat (nUni, CSV, strlen (CSV));
  printf ("nUni : %s\n", nUni);
      strncat (nUni, nom, strlen (nom)-3);
  printf ("nUni : %s\n", nUni);
      strncat (nUni, "U.csv", 5);
  
  printf ("nUni : %s\n", nUni);
  
      nDiz=malloc ((strlen (CSV)+strlen (nom)+30)*sizeof (char));
      if (nDiz==NULL) {
          printf ("Une erreure est survnue lors d'une allocation mémoire\n");
          perror ("malloc");
          exit (0);
      }
      strncat (nDiz, CSV, strlen (CSV));
  printf ("nDiz : %s\n", nDiz);
      strncat (nDiz, nom, strlen (nom)-3);
  printf ("nDiz : %s\n", nDiz);
      strncat (nDiz, "D.csv", 5);
  
  printf ("nDiz : %s\n", nDiz);
  
      trace=fopen (nTra, "r");
      unite=fopen (nUni, "w");
      dizaine=fopen (nDiz, "w");
  
      free (nTra);
      free (nUni);
      free (nDiz);
  }
  </code></pre>
  
  <p>And here is the result in a terminal :</p>
  
  <pre><code>nom :    red-queueS1D16.tr
  ../csv/
  nTra : ../traces3/
  nTra : ../traces3/red-queueS1D16.tr
  nUni : ../csv/
  nUni : ../csv/red-queueS1D16
  nUni : ../csv/red-queueS1D16U.csv
  nDiz : ../csv/
  nDiz : ../csv/red-queueS1D16
  nDiz : ../csv/red-queueS1D16D.csv
  nom :    red-queueS2D16.tr
  ../csv/
  nTra : ../traces3/
  nTra : ../traces3/red-queueS2D16.tr
  nUni : ��$../csv/
  nUni : ��$../csv/red-queueS2D16
  nUni : ��$../csv/red-queueS2D16U.csv
  nDiz : ../csv/
  nDiz : ../csv/red-queueS2D16
  nDiz : ../csv/red-queueS2D16D.csv
  nom :   red-queueS17D19.tr
  ../csv/
  nTra : ../traces3/
  nTra : ../traces3/red-queueS17D19.tr
  nUni : а$../csv/
  nUni : а$../csv/red-queueS17D19
  nUni : а$../csv/red-queueS17D19U.csv
  nDiz : ../csv/
  nDiz : ../csv/red-queueS17D19
  nDiz : ../csv/red-queueS17D19D.csv
  nom :   red-queueS17D18.tr
  ../csv/
  nTra : ../traces3/
  nTra : ../traces3/red-queueS17D18.tr
  nUni : ��$../csv/
  nUni : ��$../csv/red-queueS17D18
  nUni : ��$../csv/red-queueS17D18U.csv
  nDiz : ../csv/
  nDiz : ../csv/red-queueS17D18
  nDiz : ../csv/red-queueS17D18D.csv
  nom :    red-queueS3D21.tr
  ../csv/
  nTra : ../traces3/
  nTra : ../traces3/red-queueS3D21.tr
  nUni : а$../csv/
  nUni : а$../csv/red-queueS3D21
  nUni : а$../csv/red-queueS3D21U.csv
  nDiz : ../csv/
  nDiz : ../csv/red-queueS3D21
  nDiz : ../csv/red-queueS3D21D.csv
  </code></pre>
  
  <p>So, is anyone who can help me ?</p>
  
  <p>Thanks for all help ;)
  Phantom</p>