C/C ++/C#:如何执行"挂载-a& quot; [英] C / C++ / C#: Howto do "mount -a"

查看:65
本文介绍了C/C ++/C#:如何执行"挂载-a& quot;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题:

在C/C ++/C#中.(对于C#,我需要它,但是C和C ++也可以).

In C/C++/C#. (I need it for C#, but C and C++ is also fine).

如何在Linux上进行挂载-a.我的意思是,以编程方式开始

How can I do a mount -a on Linux. I mean programmatically, without starting a process like

system("mount -a");


注意"-a".
我的问题实际上不是关于如何挂载A挂载点.
关于如何在/etc/fstab中挂载所有挂载点.
这意味着解析文件,提取挂载点,检查是否已挂载,只有在尚未挂载的情况下才挂载...


Note the "-a".
My question is not actually about how to mount A mountpoint.
It's about how to mount ALL mountpoints in /etc/fstab.
That means parsing the file, extracting the mountpoints, check if already mounted, and only if not already mounted, mount...

推荐答案

getmntent 可以帮助您阅读/etc/fstab (然后在其他答案中使用mount函数).

getmntent can help you read /etc/fstab (and then use the mount function in the other answers).

这篇关于C/C ++/C#:如何执行"挂载-a& quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆