/*The strcpy function copies strSource, including the terminating null character, to the location specified by strDestination. No overflow checking is performed when strings are copied or appended. The behavior of strcpy is undefined if the source and destination strings overlap.*/ char* __cdecl strcpy(char* dst, constchar* src) { char* cp = dst; while( *cp++=*src++ ) ; /* Copy src over dst */ return( dst ); }
/*The strncpy function copies the initial count characters of strSource to strDest and returns strDest. If count is less than or equal to the length of strSource, a null character is not appended automatically to the copied string. If count is greater than the length of strSource, the destination string is padded with null characters up to length count. The behavior of strncpy is undefined if the source and destination strings overlap.*/ char* __cdecl strncpy ( char* dest, constchar* source, size_t count ) { char*start = dest; while (count && (*dest++=*source++)) /* copy string */ count--; if (count) /* pad out with zeroes */ while (--count) *dest++='/0'; return(start); }