How get uuid of a device/partition in linux programatically?
I am very much new to Linux programming. My questions are: Is there any 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 some commands sudo vol_id --uuid /dev/sda1 , sudo blkid and ls -l /dev/disk/by-uuid/ . But all of them are commands which need to run in a terminal. But I need to achieve this from a C/C++ program. Can some one help me with this problem. (FYI: I need to read UUID of the root filesystem ("/") where Linux has been installed.) Thank you in advance. The general approach would be: find out what