title: C++ equivalent for memset on char*
body: <p>I have this code</p>
  
  <pre><code>  char * oldname = new char[strlen(name) + 1];
  
    memcpy(oldname,name,strlen(name) + 1);
  
    name = new char[strlen(oldname) + strlen(r.name) + 1];
    memset(name, '\0', strlen(name));
  
    strcat(name,oldname);
    strcat(name," ");
    strcat(name,r.name);
  </code></pre>
  
  <p>I understand that it is a no no to use memcpy and memset but I haven't understood exactly how to use this in C++, preferably without std.</p>
  
  <p>Does anyone know? Thank you.</p>