Hello, I am writing a program for packet sniffing in Linux platform using C language. I am using MYSQL as my database for storing packet information like IP, port, packet payload, etc. I have created a table using the following query:
create table idsmatch(sip text,sport integer,dip text,dport integer,payload longtext); And, i have written a query for insertion to the table like this: sprintf(query,"INSERT INTO idsmatch(sip,sport,dip,dport,payload)VALUES('%s',%d,'%s',%d,'%s')", inet_ntoa(ip->saddr),dbsport,inet_ntoa(ip->daddr),dbdport,temp); I am able to store all values properly except 'temp'. 'temp' is a char array which holds the packet payload. What I want is to store the value of 'temp' in 'HEX' format in the table 'idsmatch'. Please tell me what is to be done for that. Thanks in advance. Preeth.