• Advertisement


This topic is now archived and is closed to further replies.

How to fix this so i can read it ?

This topic is 5091 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i wanna log what a packet have in it, the data is in unsigned int, but it need to be in char so i can print it to the logfile.
struct CUpdaterPacket
    unsigned short OpCode;
    unsigned short size;
    char *data;
	char *messageData;
	int currentSizeReceived;
	int bytesIn;
	currentSizeReceived = 0;
	struct CUpdaterPacket p;

	while (currentSizeReceived < sizeof(struct CUpdaterPacket))
	bytesIn = recv(sd, (char *)(&p + currentSizeReceived), sizeof(struct CUpdaterPacket) - currentSizeReceived, 0);
	currentSizeReceived += bytesIn;

	char bytesIn;
        log(p.OpCode); // crashes program, this i need to get to work.

        log(p.size); // same as above.

	log(&bytesIn); // works.

it complaints that it cant log p.OpCode and p.size, since its int , and need to be char. [edited by - Bmsfx on March 17, 2004 10:02:54 PM]

Share this post

Link to post
Share on other sites

  • Advertisement