- 4,663
- 36
chroot said:You can use the safe function strnlen (notice the N, it's strnlen, not strlen) to count the length of your string for you. You must pass it the length of the array, and it will not return a value past the end of the array, even if the array does not contain a NULL.
Interestingly enough, I couldn't find strnlen() mentioned in either of my books. How many arguments does it take? Thank you.