title: how to set char * value from std string (c_str()) not working
body: <p>i dont know but this not working for me im getting garbege value when i try to set char * value from function that returns std string :  </p>
  
  <pre><code>string foo()
  {
    string tmp ="dummy value";
    return tmp;
  }
  
  char* cc = (char *) foo().c_str(); // if i remove the casting im getting error 
  // when i print the cc i get garbage 
  printf("%s",cc);
  </code></pre>