本文介绍了通过套接字发送BYTE *的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过套接字发送一个BYTE *,但是发送函数只允许我发送一个char *缓冲区。这可能吗?

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?

推荐答案

使用 reinterpret_cast BYTE * 转换为 char * 。 A BYTE ,因此您不应该有任何问题。

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);

其中 bar 是您的 BYTE *

这篇关于通过套接字发送BYTE *的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-27 03:16
查看更多