Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert BYTE array to char array for send with socket c++

Tags:

c++

byte

winsock

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
    );
like image 261
Vahagn Avatar asked Jun 28 '26 17:06

Vahagn


1 Answers

BYTE b[40];
const char *p = reinterpret_cast<const char*>(b);
like image 85
vz0 Avatar answered Jul 01 '26 07:07

vz0



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!