Comment Comment by ktRolster Here is one way to handle strncpy() that works in a lot of cases:strncpy(newBuf, oldBuf, size); newBuf[size-1] = 0;That way you always end up with a null. It adds the null even when you don't need it, but that's more efficient than adding an 'if' statement. parent ktRolster 9 years ago
strncpy(newBuf, oldBuf, size); newBuf[size-1] = 0;
That way you always end up with a null. It adds the null even when you don't need it, but that's more efficient than adding an 'if' statement.