title: Coverting std::String to char *
body: <p>I need to pass string into socket send() function which accepts char * only. So here I am trying to convert it:</p>
  
  <pre><code>void myFunc(std::string str)  //Taking string here const is good idea? I saw it on some examples on web
  {
      char *buf = str.c_str;    //taking buf const is good idea?
      std::cout &lt;&lt; str;
  }
  
  int main()
  {
      const std::string str = "hello world";
      myFunc(str);
      return 0;
  }
  </code></pre>
  
  <p>Gives error: </p>
  
  <pre><code>test.cpp:6:18: error: cannot convert ‘std::basic_string&lt;_CharT, _Traits, _Alloc&gt;::c_str&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;’ from type ‘const char* (std::basic_string&lt;char&gt;::)()const’ to type ‘char*’
  </code></pre>