title: Add string to string in C with safe functions
body: <p>I want to copy the a file name to a string and append ".cpt" to it. But I am unable to do this with safe functions (strcat_s). Error: "String is not null terminated!". And I did set '\0', how to fix this using safe functions?</p>
  
  <pre><code>size = strlen(locatie);
  size++;
  nieuw = (char*)malloc(size+4);
  strcpy_s(nieuw, size, locatie);
  nieuw[size] = '\0';
  strcat_s(nieuw, 4, ".cpt"); // &lt;-- crash
  puts(nieuw);
  </code></pre>