Solved

_mbscat, mbscpy error

Posted on 2002-05-07
4
618 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:GloriousRain
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 32

Expert Comment

by:jhance
ID: 6994126
Error?? What error?
0
 
LVL 32

Expert Comment

by:jhance
ID: 6994129
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
 
LVL 86

Accepted Solution

by:
jkr earned 300 total points
ID: 6994177
Use '_mbslen()' instead of 'strlen()' - don't mix up the ANSI, UNICODE and MBCS functions.
0
 
LVL 2

Author Comment

by:GloriousRain
ID: 6994341
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C++ get user from AD  (VS6) 7 108
computer science syllabus 3 114
Need some help with Microsoft Visual Studio C++ 2003 5 85
How do I get Window Title of all opened process? 4 58
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question