Char prob
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
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
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
KISS - Keep It Simple Stupid
I tried that and i get this error:
[C++ Error] SendDataTest1.cpp(58): E2335 Overloaded ''endl'' ambiguous in this context
any other suggestions?
??
Sakira
[C++ Error] SendDataTest1.cpp(58): E2335 Overloaded ''endl'' ambiguous in this context
any other suggestions?
??
Sakira
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]
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]
[email=direwolf@digitalfiends.com]Dire Wolf[/email]
www.digitalfiends.com
www.digitalfiends.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement