How to convert a string to Unsigned char in c++...
I have,
unsigned char m_Test[8];
I want to assign a string "Hello world"
to m_Test
.
how to do it?
You can use strcpy
:
unsigned char m_Test[8];
strcpy((char*)m_Test, "Hello world");
Note that "Hello world" is too long for 8 bytes, so you will probably get a segfault.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With