SFML community forums

Help => Network => Topic started by: Everyday Everything on June 18, 2012, 07:09:14 pm

Title: Extracting sf::Int/Uint array from sf::Packet
Post by: Everyday Everything 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!
Title: Re: Extracting sf::Int/Uint array from sf::Packet
Post by: minirop on June 18, 2012, 07:28:46 pm
you can't extract an array directly, you have to do
packet >> uint8[0] >> uint8[1];
Title: Re: Extracting sf::Int/Uint array from sf::Packet
Post by: Everyday Everything on June 18, 2012, 07:33:38 pm
Thanks for the quick reply!
Guess a for loop will fix the issue easy enough  :)