1 // 2 // wcsncnt.cpp 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // Defines __wcsncnt(), which returns the number of characters in a string. If 7 // the string is longer than the given 'count', 'count' is returned. 8 // 9 #include <string.h> 10 11 12 13 extern "C" size_t __cdecl __wcsncnt( 14 wchar_t const* const string, 15 size_t const count 16 ) 17 { 18 wchar_t const* it = string; 19 size_t n = 0; 20 21 for (; *it && n != count; ++it, ++n) { } 22 23 return n; 24 } 25