メモ
void func(char* name[256], ... ){ ... string name_str = "hoge"; *name = (char*)(name_str.c_str());// 無理やり }
c_str()はconst char*を返す.
char*にstringをコピーしたい場合は一旦別の領域にコピーする.
char *ch; string str = "ABC"; // 長さが決まっているなら char s[ 256 ]; strcpy( s, str.c_str() ); // 長さが不定 char* s = new char[ str.length() + 1 ]; strcpy( s, str.c_str() ); // 処理 delete [] s; // _strdup関数 char* s = _strdup( str.c_str() ); // 処理 free( s );