Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

I asking about pcap library (See nothing about data.)

I installed libpcap library (libpcap-dev) and making a pcap test code about find default interface devices.

#include <stdio.h>

#include <pcap.h>

int main(){

    char *dev=0;

    char ebuf[PCAP_ERRBUF_SIZE]="";

    dev = pcap_lookupdev(ebuf);

    if(dev == 0){

        fprintf(stderr, "error find device: %s\n",ebuf);

        return 1;

    }

    printf("Device: %s\n",dev);

    return 0;

}

After typing my code, I compiled it with a gcc.

$gcc –o test test.c –lpcap

I expected the result

$gcc –o test test.c –lpcap    
Device: XXXXX

but after compiled it, Nothing to see about data like a picture.

$gcc –o test test.c –lpcap
$

Result.jpg

So, I also found another example about pcap, but same result.

I want to know what the problem is.

My development environment is Ubuntu 18.04 and IDE is Eclipse.

Comments