title: NSString* to char*?
body: <p>I write a piece of code which uses both c++ and Objective C.</p>
  
  <p>I need to convert <code>NSString*</code> to <code>char*</code>. <code>[str UTF8string]</code> wouldn't work because it returns <code>const char*</code>. I know:</p>
  
  <ul>
  <li><p><code>std::string</code> -> <code>char*</code> : <code>char* c = const_cast&lt;char*&gt;(pathStr.c_str());</code></p></li>
  <li><p><code>NSString*</code> -> <code>std::string</code> : <a href="https://stackoverflow.com/questions/8001677/how-do-i-convert-a-nsstring-into-a-stdstring">link</a></p></li>
  </ul>
  
  <p>But it looks too strange and I still can't verify it. Can I convert it in a better way, for example, <code>NSString*</code> -> <code>const char*</code> -> <code>char*</code></p>