title: How to remove the new-line characters from const char * type string
body: <p>I want to remove the new line characters from a string.</p>
  
  <p>So far I am only able to find remove() function but I think begin() and end() is not supporting const char * type of string.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;algorithm&gt;
  
  using namespace std;
  
  int main(){
      const char *a = "\n remove all \n the new line characters \n";
      cout &lt;&lt; a &lt;&lt; "\n";
      remove(a.begin(),a.end(),"\n");
      cout &lt;&lt; a;
  }
  </code></pre>
  
  <p>Error-</p>
  
  <pre><code>ctest.cpp: In function ‘int main()’:
  ctest.cpp:9:11: error: request for member ‘begin’ in ‘a’, which is of non-class type ‘const char*’
    remove(a.begin(),a.end(),"\n");
             ^
  ctest.cpp:9:21: error: request for member ‘end’ in ‘a’, which is of non-class type ‘const char*’
    remove(a.begin(),a.end(),"\n");
  </code></pre>
  
  <p>I also found the remove_if function on internet but it only support "isspace", "isdigit" type of filters. There was no "isnewline" and direct "\n" was throwing errors. I also found some traditional solutions which basically puts a loop on the whole string but I am avoiding those raw solutions as I am very new to this language.</p>