Safely using strncpy

This tip submitted by oliv29 on 2006-04-16 17:28:23. It has been viewed 21160 times.
Rating of 5.5 with 167 votes



when you use strncpy() always remember to add '\0' at the end of destination string. strncpy does not automatically add the terminator if the source string is longer than the destination!



More tips

Help your fellow programmers! Add a tip!