Reactos
at master 24 lines 479 B view raw
1// 2// strncnt.cpp 3// 4// Copyright (c) Microsoft Corporation. All rights reserved. 5// 6// Defines __strncnt(), 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 13extern "C" size_t __cdecl __strncnt( 14 char const* const string, 15 size_t const count 16 ) 17{ 18 char const* it = string; 19 size_t n = 0; 20 21 for (; *it && n != count; ++it, ++n) { } 22 23 return n; 24}