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

Author Topic: Extracting sf::Int/Uint array from sf::Packet  (Read 3012 times)

0 Members and 1 Guest are viewing this topic.

Everyday Everything

  • Newbie
  • *
  • Posts: 3
    • View Profile
Extracting sf::Int/Uint array from sf::Packet
« on: June 18, 2012, 07:09:14 pm »
I'm trying to extract an sf::Uint8 array from a packet but receiving this compiler error in code::blocks with SFML 2.0:
C:\BW Gaming\Sandbox RPG - Server\Incoming UDP.cpp|20|error: invalid conversion from 'sf::Uint8*' to 'char*'|

even just the simple code below gives me this error, though if I change it to char it works fine. . . should this work or am I doing something wrong?

#include <SFML/Network.hpp>
void function() {
    sf::Uint8 uint8[2];
    sf::Packet packet;
    packet >> uint8;
}
 

Thanks!

minirop

  • Sr. Member
  • ****
  • Posts: 254
    • View Profile
    • http://dev.peyj.com
Re: Extracting sf::Int/Uint array from sf::Packet
« Reply #1 on: June 18, 2012, 07:28:46 pm »
you can't extract an array directly, you have to do
packet >> uint8[0] >> uint8[1];

Everyday Everything

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Extracting sf::Int/Uint array from sf::Packet
« Reply #2 on: June 18, 2012, 07:33:38 pm »
Thanks for the quick reply!
Guess a for loop will fix the issue easy enough  :)

 

anything