Copy strings with \"strcpy\", not an idiom

Bob Larson BLARSON%ECLD at ECLA
Fri Mar 22 04:51:23 AEST 1985


I don't seem to have problems with strncpy not leaving a terminating '\0'.
Maybe this is because I always make sure the n is at least one less than
the length of the destination, and that the last character of the array
is initialized to '\0'.  I thought that this technique was obvious.

Bob Larson <BLarson at Usc-Ecl.Arpa>
  ... ucbvax!blarson at usc-ecl

"Using an outdated vocabulary can cause unpredictable results."
                                  -- Prime Information
-------



More information about the Comp.lang.c mailing list