struct int problem
Posted: Thu Sep 02, 2010 2:47 am
Hi there.
So I'm trying to create an application for Wii that communicates with my PC.
The problem I've got is `char` works, but when I use `int` it doesn't work properly. The `int` either displays a number that is totally off, or it just renders the screen to nothing. I made a PC client, and it works fine its just the Wii isn't working properly????
I've got something like for this for both Wii (client) and PC (server) its just a snipplet:
PC side
Wii side:
So I'm trying to create an application for Wii that communicates with my PC.
The problem I've got is `char` works, but when I use `int` it doesn't work properly. The `int` either displays a number that is totally off, or it just renders the screen to nothing. I made a PC client, and it works fine its just the Wii isn't working properly????
I've got something like for this for both Wii (client) and PC (server) its just a snipplet:
Code: Select all
struct info{
int x;
char a;
};
Code: Select all
void main() {
info rdata;
rdata.x = 17;
rdata.a = 'A';
int len = sizeof(rdata);
n = send(newsockfd, &rdata, len, 0);
}
Wii side:
Code: Select all
struct info recv;
int recvlength;
net_read(connection, &recvlength, 4);
GRRLIB_Printf(255, 115, tex_BMfont5, GRRLIB_LIME, 1, "recvlen: %d",recvlength);
net_recv(connection,&recv,recvlength,0);
GRRLIB_Printf(255, 125, tex_BMfont5, GRRLIB_LIME, 1, "x: %d", recv.x);
GRRLIB_Printf(255, 155, tex_BMfont5, GRRLIB_LIME, 1, "a: %c", recv.a);