Quote Originally Posted by Pappy1942
Hi,

Just do str[100] = '\0'; ///?????

This is not a good idea unless you KNOW that at least 101 char's have
been allocated for the string.

You might be putting the '\0' in the middle of another string or
variable.

Pappy
Did you actually read my whole post?
Quote Originally Posted by itsme86
Just make sure that str is at least 101 elements big.
Do you realize that strncpy(dest, src, 100); has the exact same issue? You always have to make sure the destination is big enough. My method isn't any less safe than any of the others.