Reputation: 1731
I would like to do the following in a "c" program.
I need to get the disk usage of the following directory and should be able to read it in a variable.
du -sb /home/mann | awk '{print$1}'
I would like to do the above in C program and copy the output in a variable. I need to do this for this directory alone not for the "/" or "/home".
Upvotes: 0
Views: 1265
Reputation: 24403
Another option is to use popen/pclose to launch your command. This will return a file descriptor from which you can read.
Yet another option is to hunt your system for any library function that provides the information you desire
Upvotes: 2