title: Copy string in C++
body: <p>I would like to convert this constructor's argument from <code>const char*</code> to <code>std::string</code>, but I don't know how to copy the <em>new name</em> to <em>name</em> properly. </p>
  
  <pre><code>Player::Player(const char* name) :
          level(1),life(1),strength(1),place(0){
      char* new_player_name = new char[strlen(name) + 1];
      strcpy(new_player_name, name);
      this-&gt;player_name = new_player_name;
  }
  
  Player::Player(string name) :
          level(1),life(1),strength(1),place(0){
      string new_player_name(' ',name.length() + 1); //#1
  // I didn't know how to proceed 
  }
  </code></pre>
  
  <p>The classes data-members:</p>
  
  <pre><code>class Player {
      char* player_name;
      int level;
      int life;
      int strength;
      int place;
  };
  </code></pre>