Click here to Skip to main content
15,921,156 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've tried to fixed the program with precious help but yet i've just 1 error remaining:
C++
inet_pton(AF_INET,("192.168.3.3"),&dstAddr.sin_addr.s_addr);
On this line it said:
C2660: function cannot have one argument.
This part od program I'm tryinig to build internet access with the second computer and i've replaced the function''inet_addr'' by "inet_pton"
Can you guys tell me how to fix this,plz:((
the program is as below:
C++
int main(int argc, char* argv[])
unsigned short port = 6000;
int dstSocket;
struct sockaddr_in srcAddr;
struct sockaddr_in dstAddr;
int dstAddrSize = sizeof(dstAddr);
int	flag_c, flag_s, numrcv, status;
int	flag_f;
int	send_data[9], recv_data[11];
int	send_data2[4];
	send_data2[0] = 2300 * 10;	 
	send_data2[1] = 1700 * 10;
	send_data2[2] = 100;		
	send_data2[3] = 666;
int cnt_ball = 0;	
int cnt_none = 0;	
int cnt_all = 0;	
int PR_ref[4];	
int	flag_move;
#if USE_NET
WSADATA data;
WSAStartup(MAKEWORD(2, 0), &data);
memset(&dstAddr, 0, sizeof(dstAddr));
dstAddr.sin_port = htons(port);
dstAddr.sin_family = AF_INET;
inet_pton(AF_INET,("192.168.3.3"),&dstAddr.sin_addr.s_addr);


What I have tried:

I've fix other problems but just this one remaining.
Posted
Updated 22-Oct-19 20:58pm
v2

1 solution

You are missing an '{' after this line:
int main(int argc, char* argv[])
Which means that the rest of your code is not a part of the main function at all, and I'm amazed that the error message your get is the only one ...

And why on earth do you have brackets round a string literal?
 
Share this answer
 
Comments
Member 14629414 23-Oct-19 3:05am    
@OriginalGriff
I actually had it in the source file.Maybe i forgot to paste it.
Now when correcting all the path i had 3 errors
OriginalGriff 23-Oct-19 3:17am    
Don't show us code that doesn't resemble yours! We can't diagnose code that we can;t see...

Use the "Improve question" widget to edit your question and show us the actual code you are using, together with the exact text of errors and an indication of which line they refer to.
Member 14629414 23-Oct-19 3:09am    
@OriginalGriff
The brackets are originally written in the source and whithout it it will became error.
but the original program has error too so i had to change it but i still can not make it compiled

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900