Archived

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

SAKIRA

Char prob

Recommended Posts

SAKIRA    122
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
F104    130
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
SAKIRA    122
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
Dire.Wolf    122
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