While I am working with the Evaluation Kit (contains an old Version of C51), I used "strlen()" within a function, where the string in referenced using a pointer. The result is always 2 or 3; which is the size of the pointer variable. Now I guess, "strlen()" simple consist of a "sizeof()" sourcecode. Example: // String + size char stringbuffer[] = "Hello\0"; int string_length1; // Correct Value string_length1 = strlen( stringbuffer ); // Function Call wrong_function( stringbuffer ); // Function wrong_function( char* stringpointer ) { int length_string2; // wrong value length_string2 = strlen( stringpointer ); }
http://www.keil.com/forum/6/