1 2 #include <string.h> 3 4 5 void * 6 __cdecl 7 _memccpy (void *to, const void *from,int c,size_t count) 8 { 9 char t; 10 size_t i; 11 char *dst=(char*)to; 12 const char *src=(const char*)from; 13 14 for ( i = 0; i < count; i++ ) 15 { 16 dst[i] = t = src[i]; 17 if ( t == '\0' ) 18 break; 19 if ( t == c ) 20 return &dst[i+1]; 21 } 22 return NULL; /* didn't copy c */ 23 } 24