Jump to content
  • Advertisement

Archived

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

SAKIRA

Char prob

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

Im trying to build code for a sendDataTest program from TB''s book multiplayer game dx programming and i get this error: [C++ Error] SendDataTest1.cpp(57): E2034 Cannot convert ''char ( *)[128]'' to ''char *'' at this line of code: // Received Data iBytesReceived = ClientSocketObject.Recv(&DataPacket, 128, 0); Sakira

Share this post


Link to post
Share on other sites
Advertisement
Hi!

I think the error is that you''re passing to the function a pointer to DataPacket when DataPacket is already a char pointer.

Try to delete the ''&'' before DataPacket.

Hope this can help you!

Bye Bye
F104/NA

Share this post


Link to post
Share on other sites
I tried that and i get this error:

[C++ Error] SendDataTest1.cpp(58): E2335 Overloaded ''endl'' ambiguous in this context

any other suggestions?

??
Sakira

Share this post


Link to post
Share on other sites
Somewhere you've defined a char array:

char DataPacket[128];

Then you do this:

iBytesReceived = ClientSocketObject.Recv(&DataPacket, 128, 0);

You are trying to send in a pointer to a pointer (the array) when calling the Recv() method of your class.

If you wanted to use the & operator you'd have to do this:

iBytesReceived = ClientSocketObject.Recv(&DataPacket[0], 128, 0);

When dealing with arrays, the name of the array is a pointer to the first element in the array:

&DataPacket[0] is the same as DataPacket.

So do what F104 said.


Also, I noticed that the second error you listed is on a different line (line 58) - meaning you probably fixed the original problem and now have a new one...

Dire Wolf
www.digitalfiends.com

[edited by - Dire.Wolf on March 20, 2002 2:12:24 PM]

Share this post


Link to post
Share on other sites
YYYYYYYYYYYYYEEEESSSSSSSSSSSSSSSSS!!!!!!!!!!!

You guys were right. Thx you guys now i can move on.
You Are the coolest ;]

Sakira

Share this post


Link to post
Share on other sites

  • 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!