hello again, i am a beginner and currently working on parsing pcap files.
I have successfully parsed and got data from it. After that i tried to implement it in real time but here i encountered an issue. I use dirent.h to get the newly created file by wireshark ( i am getting my pcap files from wireshark). in the code below:
char errbuff[PCAP_ERRBUF_SIZE];
system("pause");
here: pcap_t * pcap = pcap_open_offline(file.c_str(), errbuff);
struct pcap_pkthdr *header;
const u_char *data;
u_int packetCount = 0;
the point where "here" is written, pcap file is opened. after the task is performed, in my code it doesn't closes the file. My question is how to close this opened file?
is there a way to force close all opened files while code is still running?
Please post the exact error that you're seeing. Also, if possible, post the full code.
This sounds to me like a case of "the problem isn't where you think it is." Try adding temporary code to print a string to cerr just before and after the code that you think is generating the error.