Re:What I learned from my first C coding challenge
by adsr on Tuesday September 04, 2012 @03:53PM
(#4476226)
I prefer strcpy to strncpy, and make sure that the string will fit before the call. I use strncpy if I want to copy n characters from s2 to s1, strncpy can give a false sense of security imo since it may not add a terminating zero, for example using strncpy with strlen. The BSD strlcpy does always null terminate the string, but it's non standard.
[ Parent
| on HN ]
There are no comments on this comment yet.