char* to char array

I need to send

"%setmem% 0x00000000, { 0x00, 0x00 }"

to a C++ client but I need the bytes to be in a char* (string)

so I pretty much need it like this:
(this uses custom functions I made)

char* address = getarg(response).Address; //will return 0x00000000
char* bytes = getarg(response).Bytes; //will return { 0x00, 0x00 }

Any suggestions as pertaining how I may go about this

Additional Information,
I'm not using the regular C++ compiler so I cannot use a lot of C++ functions.
The safest way would be to create a std::string, add all of the components of the message, and then extract the char* using the c_str() function.

1
2
3
4
5
6
std::string msg("%setmem% ");
msg += getarg(response).Address;
msg += ", ";
msg += getarg(response).Bytes;

call_the_function(msg.c_str());


If you are not able to use std::strings, create a char[] and use snprinf() to populate it.
Topic archived. No new replies allowed.