Jump to content
  • Advertisement

Archived

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

bmsfx

How to fix this so i can read it ?

This topic is 5298 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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!