Reactos
at master 42 lines 944 B view raw
1/*** 2*strlen.c - contains strlen() routine 3* 4* Copyright (c) Microsoft Corporation. All rights reserved. 5* 6*Purpose: 7* strlen returns the length of a null-terminated string, 8* not including the null byte itself. 9* 10*******************************************************************************/ 11 12#include <string.h> 13 14#pragma function(strlen) 15 16/*** 17*strlen - return the length of a null-terminated string 18* 19*Purpose: 20* Finds the length in bytes of the given string, not including 21* the final null character. 22* 23*Entry: 24* const char * str - string whose length is to be computed 25* 26*Exit: 27* length of the string "str", exclusive of the final null byte 28* 29*Exceptions: 30* 31*******************************************************************************/ 32 33size_t __cdecl strlen ( 34 const char * str 35 ) 36{ 37 const char *eos = str; 38 39 while( *eos++ ) ; 40 41 return( eos - str - 1 ); 42}