Ushering out strlcpy()
Ushering out strlcpy()
Posted Aug 25, 2022 19:47 UTC (Thu) by Sesse (subscriber, #53779)In reply to: Ushering out strlcpy() by adobriyan
Parent article: Ushering out strlcpy()
I think it's just catastrophically named. It should be something like strtofixed() or strpad() or something; what it does is fundamentally to copy a null-terminated string into a fixed-size, non-null-terminated, buffer. Like if you have a struct of fixed-width string fields, ISAM-style. So the destination isn't a C-style string, and shouldn't be treated as such.
Of course, this makes the function much less useful than the average C programmer assumes.
