作者adrianshum (Alien)
看板C_and_CPP
標題Re: [問題] 如何將一個pointer轉為string
時間Wed Apr 8 12:08:19 2009
※ 引述《daniel76308 (嘿嘿嘿)》之銘言:
: const string &Str_hypertofile
: 這是我傳入的一個參數
: 我希望能在後面+".txt"
: 但是一直顯示不符合
: 請問有什麼方法可以改寫嗎
: 謝謝
void foo(const string& inStr) {
string fileName = inStr + ".txt";
// work on fileName
}
印象中的 std::string 應該可以過
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 202.155.236.82