关于memcpy
{ BYTE m_ucCommandBuf[1024]; //发送缓冲 memset(&flash_data, 0, sizeof(flash_data));//flash_data是一个结构体,长度为4684 flash_data.m_nTimer = 110; int nBuffLength =sizeof(flash_data); int nSend = 0; m_strOtherIP = "192.168.0.233"; while (nBuffLength >1024) { memset(m_ucCommandBuf,0,sizeof(m_ucCommandBuf)); memcpy(m_ucCommandBuf,&flash_data+nSend, 1024); this->SendTo(m_ucCommandBuf, 1024, m_nDestPort, m_strOtherIP); nBuffLength = nBuffLength - 1024; nSend += 1024; if (nBuffLength>0) { memset(m_ucCommandBuf,0,sizeof(m_ucCommandBuf)); memcpy(m_ucCommandBuf,&flash_data+nSend, nBuffLength); this->SendTo(m_ucCommandBuf, nBuffLength, m_nDestPort, m_strOtherIP); } this->SendTo(m_ucCommandBuf, nBuffLength, m_nDestPort, m_strOtherIP); }