I have a program written in C++ and I have to convert it to C#.
This program reads some pcap files.
I have add a reference to the PcapDotNet library in my new C# project but the types are not the same as in C++, like:
pcap_t *fp;
char[] errbuf = new char[PCAP_ERRBUF_SIZE];
pcap_pkthdr header;
So I don't know what is the best way to proceed, find the corresponding types with C#, or import the DLL. I found in fact that many do it in the following way:
//pcap_t *fp;
[DllImport("wpcap.dll")]
static extern int fp;
but for now it doesn't work and it gives me error.
It doesn't see DllImport and says that a ;
is missing, then also on the line below it says Invalid expression term 'static'
and ';' expected
.
The thing is, I don't have any devices or anything, the original C++ program just reads these pcap files extract the data ad does something else with it.