Using strcat in C

后端 未结 7 1667
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 15:50

Okay so I have the following Code which appends a string to another in C#, note that this is Just an example, so giving alternative string concatination met

相关标签:
7条回答
  • 2020-12-05 16:29

    As said previously, you have to write to a sufficiently large buffer. Unfortunately, doing so is a lot of extra work. Most C applications that deal with strings use a dynamically resizable string buffer for doing concatenations.

    glib includes an implementation of this, glib strings, which I recommend using for any application that uses strings heavily. It makes managing the memory easier, and prevents buffer overflows.

    0 讨论(0)
提交回复
热议问题