The implementation of strcp strlcp memcp has been written again, and I do not know how many times it is. The size of the target string, string overlapping, wide characters, and four-byte optimization are not taken into consideration.
Char * strcp (char * DEST, const char * SRC) {assert (DEST! = NULL); Assert (SRC! = NULL); If (DEST = NULL | src = NULL) return NULL; char * save = DEST; while (* DEST ++ = * SRC ++ )! = '\ 0') {} return save;} size_t strlcp (char * DEST, const char * SRC, size_t size) {assert (DEST! = NULL); Assert (SRC! = NULL); If (DEST = NULL | src = NULL | size = 0) return 0; size_t size_ret = 0; size_t n = size; while (* DEST ++ = * SRC ++ )! = '\ 0') {If (0 = -- N) break; size_ret ++;} dest --; * DEST =' \ 0'; return size_ret + 1 ;} void * memcpy (void * DEST, void * SRC, size_t N) {assert (null! = DEST); Assert (null! = SRC); If (null = DEST | null = SRC | 0 = N) return NULL; void * ret = DEST; char * dest_temp = (char *) deST; char * src_temp = (char *) SRC; while (n --) {* dest_temp ++ = * src_temp ++;} return ret ;}