strdup

#include <string>
#include <iostream>
using namespace std;

void f(const string &s) {
  cout << s;
std::string aa;
aa = s;
char* ab = strdup(aa.c_str());
  cout << aa;
  printf(ab);
}

int main() {
  f("Hello world!");
}

 

posted @ 2011-10-21 11:10  greencolor  阅读(154)  评论(0编辑  收藏  举报