问题
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