This has nothing to do with winpcap. You're doing your mysql wrong. The result you have is NOT a string yet.
You need to read a bit more about how to get the result from your query. I think this has a pretty clear example. http://www.tol.it/doc/MySQL/chapter4.html Michael D. Black Senior Scientist Advanced Analytics Directorate Advanced GEOINT Solutions Operating Unit Northrop Grumman Information Systems ________________________________ From: [email protected] [[email protected]] on behalf of WeiJie Royce [[email protected]] Sent: Friday, January 13, 2012 3:28 AM To: [email protected] Subject: EXT :[Winpcap-users] argument of type "MYSQL_RES *" is incompatible with parameter of type const char Hi guys, i'm working on a project that requires WinPcap to cature data traffic flowing from all the virtual machines. I'm almost done with the program and it has filtering. The only thing i face now is that i'm having this error. argument of type "MYSQL_RES *" is incompatible with parameter of type const char my objective is to extract data out from the database. I did it and stored it into filter_exp but it doesn't work. The codes highlighted in red has an error that i've mentioned on top. Let's see how i declare filter_exp. how do i make it in a way when i receive the result from the database. it will just insert whatever value into filter_exp. any conversion needed? --------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------- This part has no errors. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- MYSQL_RES *filter_exp; MYSQL *conn; // pointer to MySQL structure conn = mysql_init(NULL); // connection handle // Connect to MySQL database &nb sp;// host address = localhost, username = root, database = project mysql_real_connect(conn, "localhost", "root", "", "project", 0, NULL, 0); mysql_query(conn, "SELECT Filter FROM setting"); /* Send a query to the database. */ filter_exp = mysql_store_result(conn); /* Receive the result and store it in filter_exp */ mysql_free_result(filter_exp); // free the resources sprintf(cmd6, "DELETE FROM start"); mysql_real_query(conn, cmd6 , strlen(cmd6)); ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- &nb sp; -- /* * Compiling + setting the filter * */ if (lDevice->addresses != NULL) ; /* Retrieve the mask of the first address of the interface */ net=((struct sockaddr_in *)(lDevice->addresses->netmask))->sin_addr.S_un.S_addr; else /* If the interface is without an address we suppose to be in a C class network */ net=0xffffff; if (pcap_compile(lIFCHandle, &lFCode, filter_exp , 0, net) == -1) { fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle)); return(2); } if (pcap_setfilter(lIFCHandle, &lFCode) == -1) { fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle)); return(2); }
_______________________________________________ Winpcap-users mailing list [email protected] https://www.winpcap.org/mailman/listinfo/winpcap-users
