I have following code but find that x and y are the same value on the debugger. viewing ARM assembly review that the memcpy use same string address. #define A "\xA0\x00\x01" #define B "\xA0\x00\x02" memcpy(x, A, sizeof(A)-1); memcpy(y, B, sizeof(B)-1); If I change #define A "\xA0\x01\x01" #define B "\xA0\x02\x02" it will be OK. Tam
An alternative might be:
#define HEADER_0 0x0A #define HEADER_1 0x00 #define MSG_TYPE_1 0x01 #define MSG_TYPE_2 0x02 if( (in_buffer[0]==HEADER_0) && (in_buffer[1]==HEADER_1) ) { // We have detected the start of a header // Now check which type of message it is if( in_buffer[2]==MSG_TYPE_1 ) { // It is a Type-1 message } else if( in_buffer[2]==MSG_TYPE_2 ) { // It is a Type-2 message } }