I am writing a C++ code. here The goal of the program is to create single buffer from two or three different buffers. Here is the code I wrote.
#include <iostream>
#include <cstdint>
#include <cstring>
int main()
{
uint8_t LLDP_STANDARD_DST_MAC_STRING [] = {0x01,0x80,0xc2,0x00,0x00,0x0e};
uint16_t LLDP_EtherType={ 0x88CC};`
uint8_t* buf=new uint8_t[14];`
uint8_t LLDP_STANDARD_SRC_MAC_STRING[] = {0x11,0x81,0xC3,0x01,0x01,0x1e};`
memcpy(buf,&LLDP_STANDARD_DST_MAC_STRING,6);
memcpy(buf+sizeof(LLDP_STANDARD_DST_MAC_STRING),&LLDP_STANDARD_SRC_MAC_STRING,6);
std::cout << "first data " << sizeof(buf) << std::endl;
std::cout << "firt data " << (uint8_t) buf[12] << std::endl;
}
When I run the code, size of buf the code is priting 8. It is wrong? The value is not clear text. some different charatcter.
Thanks for your help.
Best regards Sothy