 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Fri May 08, 2009 12:50 pm Post subject: quick question |
|
|
Hey, i made a little program.
this is the function i have,
| Code: |
char RecvPacket[80];
int WINAPI sendto_t(
SOCKET s,
const char *buf,
int len,
int flags,
const struct sockaddr *to,
int tolen
){
RecvPacket = *buf;
if (RecvPacket[2] == 0xFC && RecvPacket[3]==0x01)
{
sendFakePlayer(RecvPacket);
}
return sendto_o(s, buf, len, flags, to, tolen);
} |
the error I get is:
error C2440: '=' : cannot convert from 'const char' to 'char [80]'
at the line RecvPacket = *buf;
how can i solve this problem?
I thought maybe using memcpy but not sure..
|
|
| Back to top |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Fri May 08, 2009 3:28 pm Post subject: |
|
|
memcpy for sure, or __movsb if you want to use intrinsic functions.
| Code: | | memcpy((LPVOID)RecvPacket, (LPVOID)buf, len); |
Assuming len is the size of the buffer.
_________________
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Mon May 11, 2009 1:48 pm Post subject: |
|
|
Thanks Lurc.
Well another problem. I want to get the ip and port of my sockaddr* to.
But i dont really know how to get it...
this is how the struct looks like:
| Code: |
struct sockaddr {
unsigned short sa_family; // address family, AF_xxx
char sa_data[14]; // 14 bytes of protocol address
}; |
can I somehow typecast it to an sockaddr_in and then get it using
| Code: | struct sockaddr_in {
short sin_family; // e.g. AF_INET, AF_INET6
unsigned short sin_port; // e.g. htons(3490)
struct in_addr sin_addr; // see struct in_addr, below
char sin_zero[8]; // zero this if you want to
}; |
Help me out please
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|