Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How read recive data? (const void*)  (Read 2151 times)

0 Members and 1 Guest are viewing this topic.

vechestva

  • Newbie
  • *
  • Posts: 25
    • View Profile
How read recive data? (const void*)
« on: March 26, 2014, 07:10:57 pm »
Hello! I need to read the incoming packets.

I can not make it through sf::Packet, since the structure of the package is not known.
I need to convert the received packet data(const void*) to "classical" set bits in hex ​​format. (example: 00:00:00:04:00:00:00:0c:68:65:6c:6c:6f:20:73:65:72:76:65:72)

ps: by TcpSocket
I do not know much English.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: How read recive data? (const void*)
« Reply #1 on: March 26, 2014, 07:44:50 pm »
Do you need to display the data in hexadecimal representation? Or do you just need it in another type (in this case you just need a cast)?

void* just means that the function can accept anything, but you're supposed to pass a typed variable, for example:

uint8_t data[10];
socket.receive(data, ...);
Laurent Gomila - SFML developer

vechestva

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: How read recive data? (const void*)
« Reply #2 on: March 27, 2014, 12:37:20 am »
Thanks!
I do not know much English.