3 ms·
I tend to stay away from the entire C style strings approach in general whenever I write C.
by camel-cdr 4y ago
I tend to stay away from the entire C style strings approach in general whenever I write C.
- cassepipe 4y agoI always use antirez's SDS string Library. The fact that they are compatible C strings with the only price to pay being a call to sdsfree() instead of free I like a lot. Simple and yet super useful. Check it out.
- anthk 4y agoStrlcpy and strlcat from OpenBSD works.
- camel-cdr 4y agoIMO you should store the size of your strings. If you know the sizes already then you can just memcpy/memmove.
- pjmlp 4y agoOnly for those that never do mistakes with parameter passing.
- pencilguin 4y ago