Yet another winsock error...
OK when I try to send an integer to the server, it gives me this error:
error C2664: ''send'' : cannot convert parameter 2 from ''int'' to ''const char *''
This is the code I''m using to send:
send(go,Player1.xpos,sizeof(Player1.xpos),0);
------------------
Stupid Morons- my current projects
quote:
Original post by BioSquirrel
send(go,Player1.xpos,sizeof(Player1.xpos),0);
try this
int xpos;
xpos = Player1.xpos;
send(go,&xpos,sizeof(Player1.xpos),0);
It wants a pointer and you''re supplying the actual variable.
I think you just need &(Player1.xpos) instead of Player1.xpos. You may have to cast it:
(char*)&(Player1.xpos)
I think you just need &(Player1.xpos) instead of Player1.xpos. You may have to cast it:
(char*)&(Player1.xpos)
I doubt that you would actually "recv" the right "xpos" value on the other side of the connection. Send() converts the integer value to only one byte when it is being send if you do it like that, and then you will end up with a whole other position. I think you have to make up another way to deal with integer values.
Please tell me if I'm wrong.
[edited by - TiStar on April 14, 2002 6:17:33 PM]
Please tell me if I'm wrong.
[edited by - TiStar on April 14, 2002 6:17:33 PM]
Bad.
Converting the pointer to a char pointer doesn''t truncate your data. Since he is passing in the size of the memory segment (size of an integer), 4 bytes will still be sent.
Dire Wolf
www.digitalfiends.com
Converting the pointer to a char pointer doesn''t truncate your data. Since he is passing in the size of the memory segment (size of an integer), 4 bytes will still be sent.
Dire Wolf
www.digitalfiends.com
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement