char stringToAdd[4097] = "";
// some manipulations on stringToAdd to add some value to it.
if(stringToAdd[0] != '\0') {
response = MethodCalledHere("Some Random text");
}
MethodCalledHere(const String& inputParameter) {
// some method definition here.
}
我已經到stringToAdd添加到「一些隨機文本」。喜歡的東西 -字符數組添加到常量字符串和C++中
response = MethodCalledHere("Some Random text" + stringToAdd);
但是這給了我錯誤 「+」不能添加兩個指針。
有什麼建議嗎?
你可以用'的std :: stringstream',或封裝第一串在構造函數... – Charles
或者使用'的std :: string'文字 – StoryTeller
的C++ 14個酷貓用' 「」 s +「一些隨機文本」+ stringToAdd;'注意內置的用戶定義文字。不像Java中的+可憎,這不是一個混亂。 – Bathsheba