如何将 char 数组的内容复制到 std::string (不转换)
前任 :
void CApp::ChangeState(GameState* state)
{
std::string strImagePath;
// cleanup the current state
if ( !states.empty() ) {
states.back()->Clean();
states.pop_back();
//states.back()->getImagePath( psImagepath );
}
// store and init the new state
states.push_back(state);
states.back()->Init();
//psImagepath = (char*)malloc(sizeof(char)*50);
states.back()->getImagePath( psImagepath );
printf("MenuState Init path %s\n",psImagepath);
}
我想将我的内容复制到 strImagePath 中(考虑 strImage 路径在类定义中声明)