1 2 #include <stddef.h> 3 #include <tchar.h> 4 5 #if defined(_MSC_VER) && defined(_M_ARM) 6 #pragma function(_tcsncpy) 7 #endif /* _MSC_VER */ 8 9 _TCHAR * _tcsncpy(_TCHAR * dst, const _TCHAR * src, size_t n) 10 { 11 if(n != 0) 12 { 13 _TCHAR * d = dst; 14 const _TCHAR * s = src; 15 16 do 17 { 18 if((*d ++ = *s ++) == 0) 19 { 20 while (-- n != 0) *d ++ = 0; 21 break; 22 } 23 } 24 while(-- n != 0); 25 } 26 27 return dst; 28 } 29 30 /* EOF */ 31