UCOS str_len_n


 #include 
using namespace std;
typedef   unsigned int         CPU_INT32U;     
typedef  volatile  CPU_INT32U  CPU_REG32;  
typedef CPU_INT32U CPU_ADDR;
typedef  CPU_ADDR    CPU_SIZE_T;    
typedef char CPU_CHAR;
unsigned int   Str_Len_N (const  char    *pstr,
                              unsigned int   len_max)
{
    const  char    *pstr_len;
           unsigned int   len;


    pstr_len = pstr;
    len      = 0u;
    while (( pstr_len != (const char *)  0 ) &&             /* Calc str len until NULL ptr (see Note #3a) ...       */
           (*pstr_len != (      char  )'\0') &&             /* ... or NULL char found      (see Note #3b) ...       */
           ( len      <  (      unsigned int )len_max)) {          /* ... or max nbr chars srch'd (see Note #3c).          */
        pstr_len++;
        len++;
    }

    return (len);                                               /* Rtn str len (see Note #3b1).                         */
}

int main()
{
std::cout<