[fpc-pascal] Get "disk" ID

Bart bartjunk64 at gmail.com
Sat Jan 5 17:03:18 CET 2019


Hi,

I need some function to get a unique ID for a disk.
I need this to identify if my program has accessed this disk previously.

On Windows I can retreive the VolumeSerialNr, but how do I do
something like that in Linux?
Mind you: the "ID" retrieved does NOT have to be the same for each platform.
(I'ld prefer if the "ID" was some kind of integer.)

So if a disk on Windows returns 1234, it is not a problem if on Linux
the same disk will return 4567.
The "ID" retrieved however must remeain the same if the disk is
removed and inserted at a later point in time (regardless of a reboot
of the system in the mean time).
If the disk was formatted before inserting a next time, it will not
matter if the "ID" changes.

Preferrably the code for linux would also work on MacOSX.

-- 
Bart



More information about the fpc-pascal mailing list