X-Git-Url: http://git.jankratochvil.net/?p=reactos.git;a=blobdiff_plain;f=lib%2Fstring%2Ftcsncpy.h;fp=lib%2Fstring%2Ftcsncpy.h;h=c8f9ab47dd093d74088eba8160c34da57ebcd946;hp=0000000000000000000000000000000000000000;hb=ee8b63255465d8c28be3e7bd11628015708fc1ab;hpb=c99688ef1ab339c8746ecc385bde679623084c71 diff --git a/lib/string/tcsncpy.h b/lib/string/tcsncpy.h new file mode 100644 index 0000000..c8f9ab4 --- /dev/null +++ b/lib/string/tcsncpy.h @@ -0,0 +1,28 @@ +/* $Id$ + */ + +#include +#include + +_TCHAR * _tcsncpy(_TCHAR * dst, const _TCHAR * src, size_t n) +{ + if(n != 0) + { + _TCHAR * d = dst; + const _TCHAR * s = src; + + do + { + if((*d ++ = *s ++) == 0) + { + while (-- n != 0) *d ++ = 0; + break; + } + } + while(-- n != 0); + } + + return dst; +} + +/* EOF */