Modify a char* string in C

前端 未结 6 1270
既然无缘
既然无缘 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:53

    Take a look at strstr, strcat and other cstring/string.h functions.

    Make sure your char arrays are large enough to hold concatenated strings. Like, you may want to do the following:

    char neworiginal[1024];
    

    etc.

提交回复
热议问题