Sending BYTE* over socket

☆樱花仙子☆ 提交于 2020-01-05 09:30:09

问题


I'm trying to send a BYTE* over a socket, but the send function only allows me to send a char* buffer. Is this possible? How would I go about casting it back on the other side?


回答1:


Use reinterpret_cast to cast from BYTE* to char*. A BYTE is an unsigned char typedef, so you shouldn't have any issues.

char* foo = reinterpret_cast<char*>(bar);

Where bar is your BYTE*.



来源:https://stackoverflow.com/questions/27513776/sending-byte-over-socket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!