[Winpcap-users] EXT : argument of type "MYSQL_RES *" is incompatible with parameter of type const char

Black, Michael (IS) Michael.Black2 at ngc.com
Fri Jan 13 04:01:33 PST 2012

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.


Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

From: winpcap-users-bounces at winpcap.org [winpcap-users-bounces at winpcap.org] on behalf of WeiJie Royce [penril_3 at hotmail.com]
Sent: Friday, January 13, 2012 3:28 AM
To: winpcap-users at winpcap.org
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;
        /* If the interface is without an address we suppose to be in a C class network */

if (pcap_compile(lIFCHandle, &lFCode, filter_exp , 0, net) == -1) {
fprintf(stderr, "Couldn't parse filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle));
if (pcap_setfilter(lIFCHandle, &lFCode) == -1) {
fprintf(stderr, "Couldn't install filter %s: %s\n", filter_exp, pcap_geterr(lIFCHandle));
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winpcap.org/pipermail/winpcap-users/attachments/20120113/cc9c263a/attachment.html>

More information about the Winpcap-users mailing list