HN
Hacker News
Top
New
Best
Ask
Show
Jobs
Comment by dhsysusbsjsi | Hacker News Reader
Parent
Full thread
dhsysusbsjsi
·
That’s what strncpy() is for
View on HN
saagarjha
·
Watch out: what strncpy does is usually
not
what you'd want it to do.
shawxe
·
That's what strlcpy() is for.
saagarjha
·
Or strncpy, if you'd like to stay within the standard and your strings are small.
jjnoakes
·
No, it's not. strcpy is fine to use if the destination buffer is larger than you need or uninitialized. That's idiomatic...
Reply on news.ycombinator.com