C / C ++ / C#:HOWTO做"安装-a" [英] C / C++ / C#: Howto do "mount -a"

查看:139
本文介绍了C / C ++ / C#:HOWTO做"安装-a"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问:

在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。

我的问题其实不是关于如何安装一个挂载点。

它是关于如何安装在/ 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文件(然后使用其他答案安装功能)。

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

这篇关于C / C ++ / C#:HOWTO做"安装-a"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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