[fpc-pascal] cannot read /sys/class/net/eth1/address even as root user on linux

Dennis Poon dennis at avidsoft.com.hk
Thu Dec 5 12:33:38 CET 2013

I tried to read the mac address in the captioned file path.
In terminal, I can simply 'cat' and display the mac address.

In FPC, when I tried to use TFileStream to read it,

   FS := TFileStream.Create('/sys/class/net/eth1/address', 

it raised "stream read error"

If I tried to use TextFile and readln, it even halted the program.

My question is:
   Why 'cat' command can easily display this special file 'address' but 
TFileStream cannot.

I was told to use this method to get the MAC address of a network card, 
what other methods are there?


More information about the fpc-pascal mailing list