Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to send encrypted data using
public: int Send(unsigned char __gc[], int, int, SocketFlags)
the encrypted data is stored in the char * variable.
how to convert char * to unsigned char __gc[]
Posted

1 solution

I haven't done any CLI C++ in a long time so there's probably a much cleaner way of doing this but you could just iterate over the encrypted data like this;

C++
char* encrypted = "Hello, World!";
int length = 13;

unsigned char socketData __gc[]  = new unsigned char __gc[length];

for(int i = 0; i < length; ++i)
{
    socketData[i] =  static_cast<unsigned char>(encrypted[i]);
}


Hope this helps,
Fredrik Bornander
 
Share this answer
 
Comments
worldfishy 25-May-11 6:17am    
Thank you very much.
Fredrik Bornander 25-May-11 6:27am    
Glad I could help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900