Thread: Get MAC Address in C

  1. #1
    Registered User
    Join Date
    Jun 2011

    Get MAC Address in C


    I'm trying to get the mac address from a client which runs the c program. I have found the code which returns the MAC address on Unix but I want to do it on Windows. If anyone could help I'll thank him.

    Thank you!

  2. #2
    Join Date
    Aug 2010
    Ontario Canada
    // get a host's mac address
    BOOL GetMacAddr(SOCKADDR Host, PBYTE Mac)
      { ULONG     smac = 6;           // size of mac address
        // get mac address
        if (SendARP(((PSOCKADDR_IN) &Host)->sin_addr.S_un.S_addr,0,
                                      (PULONG)Mac,&smac) == NO_ERROR)
          return 1;
        return 0; }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 11-07-2010, 11:39 PM
  2. why same address? Need help...
    By tuan28064 in forum C Programming
    Replies: 3
    Last Post: 06-03-2010, 09:12 AM
  3. Block address from word address
    By xddxogm3 in forum Tech Board
    Replies: 0
    Last Post: 04-25-2007, 09:02 PM
  4. My IP Address
    By CppProgrammer in forum Tech Board
    Replies: 10
    Last Post: 06-28-2003, 05:10 PM
  5. IP address
    By nt259 in forum C++ Programming
    Replies: 2
    Last Post: 01-01-2003, 08:53 AM