Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
How to find hard disk space (free) through c++ code?
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
rag84dec
New Member
Join Date:
Mar 2007
Posts:
100
#1
How to find hard disk space (free) through c++ code?
Jun 22 '07, 11:05 AM
HI,
Can anyone give me some idea?
archonmagnus
New Member
Join Date:
Jun 2007
Posts:
113
#2
Jun 22 '07, 12:14 PM
Without interfacing a specific API, you could pipe the output from the system command into a file and read-in the disk space. For example:
[CODE=cpp]
// For Unix, Linux, BSD, etc.
system("df -hl [disk or mount point] > output.txt");
// For Windows/DOS
system("dir /-C [disk] > output.txt");
// Where [disk] could be: "C:", "/dev/sdb1", etc.
[/CODE]
Then you simply have to open the file "output.txt " and parse the disk sizes back in.
Comment
Post
Cancel
vpawizard
New Member
Join Date:
Nov 2006
Posts:
66
#3
Jun 23 '07, 05:26 AM
Use the system calls or API.
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment