Modify a char* string in C

前端 未结 6 1261
既然无缘
既然无缘 2021-01-27 23:32

I have this:

char* original = \"html content\";

And want to insert a new

char* mycontent = \"newhtmlinsert\";

6条回答
  •  囚心锁ツ
    2021-01-27 23:57

    C++ doesn't have + operator for char * strings. You need to use std::string, i.e.

    std::string neworiginal = "html content before ";
    neworiginal += "newhtlminsert";
    neworiginal += "..."
    

提交回复
热议问题