[gameprogrammer] Re: problem filling a buffer



Rasmus Toftdahl Olesen escribió:


One thing that could ease filling a buffer i to just use a structure to
hold your data, and then pass a pointer to that as the buffer, e.g.:

static const int COMMAND_LOGIN = 20;
static const int MAX_STRING = 10;
typedef struct {
        int command;
        char username[MAX_STRING];
        char password[MAX_STRING];
} Login;
Thanks for illustrating the use of SDLNet_Write. I will switch all my code to use it. But in this case, the compiler does not includes padding or something to align struct members?

--
http://dsgp.blogspot.com | Linux, programación, juegos
Have no place I can be since I found Serenity
But you can’t take the sky from me

                
______________________________________________ LLama Gratis a cualquier PC del Mundo. Llamadas a fijos y móviles desde 1 céntimo por minuto. http://es.voice.yahoo.com

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: