title: C++ error trying to 'rewrite' char array
body: <p>I am trying to convert a string into all upper case using the code:</p>
  
  <pre><code>int client::get_upper(char*item_in)
  {
      int k ;
      char * temp_str;
      int length = strlen(item_in);
      temp_str = new char [length+1];
      for(k = 0; k &lt; length; ++k)
          temp_str[k] = toupper(item_in[k]);
      temp_str[k] = '\0';
      for(k = 0; k &lt; length; ++k)
          item_in[k] = temp_str[k];
      return 0;
  }
  </code></pre>
  
  <p>Yet when I attempt to do so I receive an access violation writing location xxxxxxxx from Visual Studio.  This is for a class, so I am restricted from using actual strings.</p>