变量不是返回值 [英] Variable Isn't Returning Value

查看:96
本文介绍了变量不是返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个变量,该变量将IP作为字符串提供给我..... ipSrc但是,我不确定它是否在SQl语句中返回正确的值.我将IP存储为转换后的数字,然后从那里进行比较. 65.39.148.34转换为580134721,这就是存储在MySQL表中的内容.这是代码.


I have a variable that is giving me the IP as a string.....ipSrc However I''m not sure if it''s returning the correct value in the SQl statement. I''m storing the IP''s as converted numbers and then comparing them from there. 65.39.148.34 converts to 580134721 and thats what is stored in the MySQL table. Here is the code.


int *addressValue = new int();
char *address = LIP; 
inet_pton(AF_INET, address, addressValue);
	if (ip_header->source_ip == *addressValue)
	{
	printf("\n   Source      IP: %s", "0.0.0.0");
	printf("\n   Destination IP: %s", ipDest);
	}
	else
	{
	printf("\n   Source      IP: %s", ipSrc);
	printf("\n   Destination IP: %s", ipDest);
	if (mysql_real_connect(conn,"urlock.db.5513143.hostedresource.com","VendorCheck","Reader1234","urlock",0,NULL,0) !=0)
	{
	(mysql_query(conn,"SELECT COUNT(*) FROM tblURLIP WHERE IP = inet_ntoa(ipSrc) 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);

推荐答案

是否可以通过调试器运行它,并在感兴趣的变量处设置断点以分析其值?如果没有,您可以放入打印语句来打印变量值吗?当处理复杂的代码块时,这些是您最好的工具.

:)

祝你好运!
Can you run it through a debugger and set break points at variables of interest to analyse their values? If not, can you put in print statements to print variable values? When dealing with complex blocks of code, these are your best tools.

:)

Good luck!


这篇关于变量不是返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆