Here is a simple example on how to read device MAC address in Linux
{$mode objfpc}
program get_mac;
uses sysutils;
const
linux_path = '/sys/class/net/%s/address';
default_device = 'eth0';
var
f : textfile;
device,
path,
addr : string;
begin
device := default_device;
if (ParamCount = 1) then
begin
device := ParamStr(1);
end;
path := Format(linux_path,[device]);
if Not FileExists(path) then
begin
writeln('Could not find the device: ', device);
halt(1);
end;
AssignFile(f, path);
reset(f);
readln(f,addr);
closefile(f);
writeln(device, ' MAC Address: ', addr);
end.
Ido
http://ik.homelinux.org/
2010/5/10 Leonardo M. <[email protected]>
> Hi, does anyone knows how to get the MAC address of a NIC using
> Lazarus/FPC on Linux?.
>
> P.S.: I found plenty of examples using Delphi's "Nb30" unit, only for
> Windows.
>
> --
> Leonardo M. Ramé
> Griensu S.A. - Medical IT Córdoba
> Tel.: 0351-4247979
>
>
> --
> _______________________________________________
> Lazarus mailing list
> [email protected]
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus