Andrea Mauri wrote:
I would like to convert a delphi/kylix project in lazarus project.
In the kylix project there is also a function that checks the MAC address:

 ethernet:= 'eth0';
 i:= socket(AF_INET, 2, 0) ;
 if not i < 0 then
 begin
   StrPLCopy(@f.ifrn_name, ethernet, IFNAMSIZ);
   if not ioctl(i,SIOCGIFHWADDR,@f) < 0 then
   begin
     m := @f.ifru_dstaddr.sa_data;   // MAC
     FmtStr(MAC,'%.2x:%.2x:%.2x:%.2x:%.2x:%.2x',
      [Byte(m[0]),
       Byte(m[1]),
       Byte(m[2]),
       Byte(m[3]),
       Byte(m[4]),
       Byte(m[5])]);
   end;
 end;

There is a way to do it also with lazarus/fpc?

I think it can. use unix and/or baseunix and replace socket/ioctl with fpsocket/fpioctl

(I didn't check)

Marc

_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to