From: John B. <jv...@pr...> - 2003-07-26 21:27:15
|
Matthew Wilcox wrote: > seems to me you'd be better off doing ... > > len = strlen(str); > if (len > n) > len = n; > memcpy(str2, str, n); > str2[n] = '\0'; > > i wrote a short note entitled "strncpy Considered Harmful" a few years ago. > unfortunately, it seems lost in time. Since you have that experience then I would expect you to consider whether str is zero-terminated before suggesting that I change my code. -- http:// if l .o / |