Const unsigned char* to char8

Posted by BSchlinker on Stack Overflow See other posts from Stack Overflow or by BSchlinker
Published on 2010-04-05T02:12:01Z Indexed on 2010/04/05 2:13 UTC
Read the original article Hit count: 301

Filed under:
|
|
|
|

So, I have two types at the moment:

const unsigned char* unencrypted_data_char;
string unencrypted_data;

I'm attempting to perform a simple conversion of data from one to the other (string -> const unsigned char*)

As a result, I have the following:

strcpy((unencrypted_data_char),(unencrypted_data.c_str()));

However, I'm receiving the error:

error C2664: 'strcpy' : cannot convert parameter 1 from 'const unsigned char *' to 'char *'

Any advise? I thought using reinterpret_cast would help, but it doesn't seem to make a difference.

© Stack Overflow or respective owner

Related posts about conversion

Related posts about string