How to get MAC address using C program
Pls any body tell me how to find out a MAC address in a program, Because I want to generate pseudo random number of IP address of some range for that MAC address and IP range will be the input and it should give IP address according to MAC address as a seed , but if I use difft MAC address (i,e for difft host ) it should give difft IP address, But if I give first MAC address it should give the same old IP address, So pls send me answer as soon as possible code in C and also if possible ALGORITHMS pls its very urgent Thank you, Regards Girish.L.C [EMAIL PROTECTED] - Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail Beta. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
How to get MAC address using C program
Hi, Can anybody help me out to retrieve MAC address of my machine... using a C program I gave it a try using ioctl but not getting the correct result.. Following is my code.. int main() { .. struct ifr_req ifr ; strcpy(ifr.ifr_name, "rl0"); if( ioctl(s, SIOCGIFADDR, &ifr) < 0 ) { cout << "Error" << endl ; return 0 ; } printf("ADDR(%s) = ") ; for(int i = 0; i < 6; i++) { printf("%x :", ifr.ifr_addr.sa_data[i] ) ; } its not printing the correct result Thanks in advance Dennis __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: How to get MAC address using C program
Could you exec() ifconfig? On 5/30/06, girish girishlc <[EMAIL PROTECTED]> wrote: Pls any body tell me how to find out a MAC address in a program, Because I want to generate pseudo random number of IP address of some range for that MAC address and IP range will be the input and it should give IP address according to MAC address as a seed , but if I use difft MAC address (i,e for difft host ) it should give difft IP address, But if I give first MAC address it should give the same old IP address, So pls send me answer as soon as possible code in C and also if possible ALGORITHMS pls its very urgent Thank you, Regards Girish.L.C [EMAIL PROTECTED] - Do you Yahoo!? Get on board. You're invited to try the new Yahoo! Mail Beta. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]" ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: How to get MAC address using C program
On Wed, 31 May 2006 07:43:44 -0400 "Jim Stapleton" <[EMAIL PROTECTED]> wrote: > Could you exec() ifconfig? at the risk of stating the bleeding obvious, maybe checking the code in ifconfig would show exactly what the original poster asked... you gotta love OpenSource ;) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"