如何将BYTE数组转换为char数组,使用socket c ++发送 [英] how to convert BYTE array to char array for send with socket c++

查看:2014
本文介绍了如何将BYTE数组转换为char数组,使用socket c ++发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些问题。
我写客户端服务器应用程序,其中信息发送&接收与胜利套接字。在我的项目需要发送 BYTE 数组到客户端,在客户端这个字符数组转换为 BYTE ,我如何创建它,请帮助我,因为 send()函数只能发送 char * 。谢谢。

I have some problem. I write client server app where information send & receive with win socket. On my project need send BYTE array to client, and on client this char array convert to BYTE, how I can create it, please help me, because send() function can send only char*. Thank you.

WSAAPI
send(
    __in SOCKET s,
    __in_bcount(len) const char FAR * buf,
    __in int len,
    __in int flags
    );


推荐答案

BYTE b[40];
const char *p = reinterpret_cast<const char*>(b);

这篇关于如何将BYTE数组转换为char数组,使用socket c ++发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆