[Info-vax] C str calls
JF Mezei
jfmezei.spamnot at vaxination.ca
Sat Aug 22 15:21:21 EDT 2015
On 15-08-22 13:13, Simon Clubley wrote:
> strncpy() only stops you from walking off into never-never land while
> processing the source argument.
mystring[sizeof(mystring)-1] = 0x00 ; following strncpy fixes the issue
by null terminating the string no matter what.
personnally, I think memcpy is safer than snrncpy because it makes it
obvious that the copy operation does not null terminate the string,
which must be done separately (or string handled as a descriptor type
with length stored elsewhere)
More information about the Info-vax
mailing list