I am very new to Linux programming.
My questions:
- Is there a way to read the UUID of a device or partition in Linux programmatically?
- Is there any C / C ++ API for user space applications?
I found several sudo vol_id --uuid /dev/sda1 , sudo blkid and ls -l /dev/disk/by-uuid/ . But all of them are commands that need to be run in the terminal. But I need to achieve this from a C / C ++ program.
Can someone help me with this problem. (FYI: I need to read the UUID of the root file system ("/") where Linux was installed.)
Thanks in advance.
c ++ c linux uuid
user502814
source share