Someone can tell me why this piece of code doesn't work?

#include<stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <net/if.h>
#include <net/if_mib.h>

int main(void) {
  int mib[5], *count;

  mib[0]=CTL_NET;
  mib[1]=PF_LINK;
  mib[2]=NETLINK_GENERIC;
  mib[3]=IFMIB_SYSTEM;
  mib[4]=IFMIB_IFCOUNT;

  sysctl(mib, 5, count, sizeof(int),(void *)NULL, NULL);

  printf("count: %d\n",*count);
  
}

I'm searching the number of interfaces available.

thanks.

-- 

Paolo

Visit the Italian FreeBSD User Group Site: www.gufi.org

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to