3 ms·
But doing that if you have a large ancient C code base is a lot of work. The reason for the existence of strlcpy isn’t that it is perfect, it’s that it’s the b
by Someone 2y ago
But doing that if you have a large ancient C code base is a lot of work.
The reason for the existence of strlcpy isn’t that it is perfect, it’s that it’s the best option with good UX for integration into an existing C code base.
- saagarjha 2y agoIt's not, though. That's the point: the interface it provides is not very good. The API surface for "I have a string here and I want you to put it there but only the first n bytes" is well-defined and can be done in a much better way than what strlcpy does.