subnet - Obtaining SubnetMask in C -


i wanted ip address , subnet mask. ip part done, couldn't find socket function return structure subnet mask in it. socket function exist, returns in structure?

thanks!

in windows using iphelper.

#include <winsock2.h> #include <iphlpapi.h> #include <stdio.h> #include <stdlib.h> #pragma comment(lib, "iphlpapi.lib")  #define malloc(x) heapalloc(getprocessheap(), 0, (x)) #define free(x) heapfree(getprocessheap(), 0, (x))  /* note: use malloc() , free() */  int __cdecl main() {      pip_adapter_info padapterinfo;     ulong uloutbuflen = sizeof (ip_adapter_info);     padapterinfo = (ip_adapter_info *) malloc(sizeof (ip_adapter_info));     getadaptersinfo(padapterinfo, &uloutbuflen);     printf("\tip mask: \t%s\n", padapterinfo->ipaddresslist.ipmask.string);     }     if (padapterinfo)         free(padapterinfo);      return 0; } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -