_mbscat, mbscpy error

Hello all,
I have written a function that used _mbscat and _mbscpy to change string to hexa string but it gets error. Please help me to solve this problem. Here is my function:

int StringToHexString(unsigned char * Source)
{
     char buffer[MAX_LEN_PASSWORD];
     unsigned char password[MAX_LEN_PASSWORD];
     int i;    
     password[0] = '\0';
     int len = strlen((char *)Source);
     for (i = 0; i < len; i++)
     {
          _ultoa(Source[i], buffer, 16);
          if (strlen((char *)buffer) < 2)
               _mbscat(password, (const unsigned char *)"0");

          _mbscat(password, (const unsigned char *)buffer);
     }
     _mbscpy(Source, password);
     return 1;
}

Do not try to help me to write another function. Just help me to make it better. Error just appears on Win2k.
Thanks.
LVL 2
GloriousRainAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jkrConnect With a Mentor Commented:
Use '_mbslen()' instead of 'strlen()' - don't mix up the ANSI, UNICODE and MBCS functions.
0
 
jhanceCommented:
Error?? What error?
0
 
jhanceCommented:
What about this question:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=mfc&qid=20177990

Are you ever going to resolve it?

Why should an expert waste time on this question if you're likely to just leave it hanging as well?
0
 
GloriousRainAuthor Commented:
Thank you so much, jkr. That works fine now.
jhance, thanks for your comments. Please forgive me, i have not much time.
Thank you all.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.