title: Remove items from a char * C++
body: <p>I am trying to remove characters from a char pointer and would like to store them back in a new char pointer variable let's say "temp". So I would have something like this:</p>
  
  <pre><code>char *test = "1@2#3$4%5^6&amp;7*8!9@1#0";
  char *temp = "";
  </code></pre>
  
  <p>then remove the "@,#,$,%,^,*,!,@,#," and place the new values of "12345678910" into *temp. This would make temp be equal to "12345678910".</p>
  
  <p>Is this possible? </p>
  
  <p>I have been doing this with string but I really need to do this with the char pointers. Here is how I have done this with string:</p>
  
  <pre><code>std::string str("1@2#3$4%5^6&amp;7*8!9@1#0");
  std::string temp("");
  
      char chars[] = "@#$%^&amp;*!";
  
      for (unsigned int i = 0; i &lt; strlen(chars); ++i)
     {
         str.erase (std::remove(str.begin(), str.end(), chars[i]), str.end());
  
      }
      temp = str;
  </code></pre>
  
  <p>So you see here I am doing this all will strings but I just cannot seem to get away with asigning a char * variable like test to a string because its an illegal conversion. However why am I able to set my char * variables equal to string like so?</p>
  
  <pre><code>char *test = "123456789";
  </code></pre>
  
  <p>However this is illegal?</p>
  
  <pre><code>std::string str("1@2#3$4%5^6&amp;7*8!9@1#0");
  
      char chars[] = "@";
  
      for (unsigned int i = 0; i &lt; strlen(chars); ++i)
     {
         str.erase (std::remove(str.begin(), str.end(), chars[i]), str.end());
  
      }
  
      char *test = str; //Illegal point
  </code></pre>
  
  <p>Thank you for your time.</p>