Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定:UNIX 文件系统上文件的路径
如何以在类 UNIX 系统(包括 OS X)中最便携的方式获取存储它的设备的 UUID,可能通过 C 的库调用?
您可以调用int stat(const char *path, struct stat *buf)并且 buf->st_dev 将为您提供设备的 ID。stat() 是 POSIX.1。