Home > Software engineering >  Udp can transceiver with character array structure? With the structure of character pointer can send
Udp can transceiver with character array structure? With the structure of character pointer can send

Time:12-05

Such as:
Struct data
{
Char a, [100].//character array
Char * b;//character pointer
};
This structure can send and receive???
As long as with character pointer accept , access error occurs, the send no display error, why character pointer can not get correct data,
Struct data buffer;
Buffer. B=(char *) malloc (sizeof (char) * 100);

Recvfrom (sServer (char *) & amp; Buffer, sizeof (struct data), 0,...
Sendto (sServer (char *) & amp; Buffer, sizeof (struct data), 0,...

Transceiver with character pointer structure, how to do, you can write a simple example? My old server error, 0 xc0000005: Access Violation.

CodePudding user response:

Can only send the entity in the communications, can according to the "length, data" such way to convert the string pointer to the actual data

  • Related