strcat concat a char onto a string?

后端 未结 6 743
谎友^
谎友^ 2020-12-14 22:45

Using GDB, I find I get a segmentation fault when I attempt this operation:

strcat(string,¤tChar);

Given that string is initializ

6条回答
  •  不知归路
    2020-12-14 23:14

    I think the simplest method (not efficient) would be sprintf

    sprintf(str, "%s%c", str, chr);

提交回复
热议问题