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.
我希望以编程方式在 Linux 中挂载 USB 驱动器,以便可以使用 fprintf 编写文本文档。我无法找出如何安装驱动器。我一直在网上搜索答案,我找到了许多关于如何通过命令行执行此操作的教程,但在 C 语言中没有。有人可以指出我正确的方向吗?
man 2 mount
例如
#include <sys/mount.h> if (mount("/dev/mmcblk0p1", "/mnt/sd", "vfat", MS_NOATIME, NULL)) { if (errno == EBUSY) { printf("Mountpoint busy"); } else { printf("Mount error: %s", strerror(errno)); } } else { printf("Mount successful"); }