?
Solved

How to get hard disk space using C

Posted on 2008-11-13
7
Medium Priority
?
800 Views
Last Modified: 2012-06-21
Hi, How to get the hard disk space using c on linux box.
0
Comment
Question by:santosh_bettad
7 Comments
 
LVL 5

Expert Comment

by:adamskiangel
ID: 22949096
basic linux command sheet:

http://www.pixelbeat.org/cmdline.html

0
 
LVL 11

Expert Comment

by:alexcohn
ID: 22949163
call

system("df > /tmp/df.out");

and parse the output file accordinfg to df command manual http://www.computerhope.com/unix/udf.htm

Maybe you want to use parameters for df command to limit the search or change formatting.
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 150 total points
ID: 22949202
All the information you need is in the procfs file system.
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
LVL 53

Expert Comment

by:Infinity08
ID: 22949209
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 23032712
Since you gave a B grade, I assume that something is still unclear. Do not hesitate to ask for clarification where needed in that case.
0
 

Author Comment

by:santosh_bettad
ID: 23040269

We expected something like system call to get that information. This is also good one, now using the same one.
Thanks.
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 23041215
The procfs file system is the standard interface to get this kind of information (that's what it was designed for anyway).


>> We expected something like system call to get that information.

Maybe what you were looking for is statvfs ?

        http://linux.die.net/man/2/statvfs
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question