I'd like to append an unsigned char* to another unsigned char* to create a long string that can be returned to a parent function and parsed. I have the following:
unsigned char *bytes = NULL;
unsigned char *retVal = NULL;
int intVal1, intVal2;
bytes = readRegister(0x01);
if ( bytes != NULL )
{
intVal1 = (*(int *)bytes) & 0xffffffff;
printf("intVal1 = 0x%x\n", intVal1); //intVal1 = 0x7fffac00
}
bytes = readRegister(0x02);
if ( bytes != NULL )
{
intVal2 = (*(int *)bytes) & 0xffffffff;
printf("intVal2 = 0x%x\n", intVal2); //intVal2 = 0x7fffac11
}
How can concatenate the values of intVal1 and intVal2 so retVal would equal "7fffac007fffac11"? Or is there a way to concatenate "bytes" to retVal after each call to readRegister()?
Any help is greatly appreciated!