vcc++5 int* to char*
hello!
im using this struct
typedef struct objinfo_typ
{
int objinfo.nr;
int objinfo.xpos;
int objinof.ypos;
int objinfo.anim;
}
objinfotyp myobjinfo;
than i will recieve data into this struct from a server using winsock with the following code:
recv(s, (char*)myobjinfo, sizeof(objinfo_typ), 0);
the problem is that the resv function wants a CHAR POINTER to the buffer ((char*)myobjinfo) and that
the conversion (char*)myobjinfo dont work...
i am something new to type/pointer conversion and it will be great if somebody can help me
thanks for all
elmo
August 06, 2000 08:33 AM
You can not cast an object. Use the address operator ''&'' and it will work...
recv(s, (char*)&myobjinfo, sizeof(objinfo_typ), 0);
Jens
recv(s, (char*)&myobjinfo, sizeof(objinfo_typ), 0);
Jens
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement