Click here to Skip to main content
16,006,065 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm having a problem with inet_aton(). In the MySQl database the IP is stored as an INT(11) unsigned however when I try to access this record it always fails.

C++
mysql_query(conn,"SELECT COUNT(*) FROM tblURLIP WHERE IP = inet_aton('65.39.148.34') And IPStatus = 1 And IPMax = 0");
		my_ulonglong i = 0;
		res_set = mysql_store_result(conn);
		my_ulonglong numrows = mysql_num_rows(res_set);
		LEGIT = mysql_fetch_row(res_set);
		if (atoi(LEGIT[i]) == 1) 
Posted
Comments
Member 7766180 4-Aug-11 23:38pm    
what number does inet_aton('65.39.148.34') return exatly?
Member 7766180 4-Aug-11 23:45pm    
Is it 580134721

1 solution

what number does inet_aton('65.39.148.34') return exatly?
65x2563 + 39x2562 + 148x256 + 34 = 1093112866
The formula is here[^]
 
Share this answer
 
Comments
Member 7766180 5-Aug-11 11:28am    
Thank you. Is that little number squared or to the power of?
walterhevedeich 5-Aug-11 12:22pm    
yes it is raised to the power of n.

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