I\'m trying to convert a struct to a char array to send over the network. However, I get some weird output from the char array when I do.
#include
char is a signed type so what you are seeing is the two-compliment representation, casting to (unsigned char*) will fix that (Rowland just beat me).
On a side note you may want to change
for (i=0; i<4; i++) { //... }
to
for (i=0; i