LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   api to list Filesystem names (c++) (https://www.linuxquestions.org/questions/linux-software-2/api-to-list-filesystem-names-c-914683/)

vipulspn 11-21-2011 06:39 AM

api to list Filesystem names (c++)
 
Hi,

How can I list Filesystem name if I have a path in c++.

for example: if i fire following command on shell:
df -k /someloc

Filesystem 1K-blocks Used Available Use% Mounted on
machine3:/someloc 18874 13808 15066 74% /some1/some2/someloc

I just want output Filesystem name. I looked into df source code. I could not understand it much. I was wondering if there was a simple way to achieve the task.

Thanks,
Vipul

jthill 11-21-2011 10:52 PM

You asked this already, and I told you the API: read /proc/self/mounts and find the longest matching prefix. The only thing I didn't do was to actually write the C++ for you.


All times are GMT -5. The time now is 07:53 PM.