Get MAC Address in C

This is a discussion on Get MAC Address in C within the Windows Programming forums, part of the Platform Specific Boards category; Hello, I'm trying to get the mac address from a client which runs the c program. I have found the ...

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    4

    Get MAC Address in C

    Hello,

    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
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Code:
    
    // 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, 10: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, 07:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21