I have this string.
char * data = "A1B2C3D4E5F6A7B8";
Here each A1 B2 C3 D4 E5 F6 A7 B8 will be bytes for unsigned char* buffer.
My concern is how to convert the data into unsigned char* buffer.
unsigned char* buffer;
buffer = (unsigned char*)data;
I will use the buffer for a parameter of a function like this to write the data into memory.
int abc(uint64_t address, buffer, uint32_t lenght);
Can anyone please give me a correct way?
Here it is a demo about the char* buffer, unsigned char* and string.
The output
To compile and run
P.S.
The above line would cause a warning when compiling because the string is immutable. Better changes it to
char const * data = "A1B2C3D4E5F6A7B8";