Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

cstr

By: a guest on Oct 22nd, 2012  |  syntax: C++  |  size: 0.23 KB  |  hits: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. void some_function(string str)
  7. {
  8.     cout << "str : " << str.c_str() <<endl;
  9. }
  10.  
  11. int main() {
  12.   const char* cstr = "Hello World!";
  13.   some_function(string(cstr));
  14. }