Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Size of Harddisc

Status
Not open for further replies.

666cartman

Programmer
Aug 27, 2002
20
0
0
DE
How can i get the size of an HD on a Linux system ?
I need it for an Benchmark program i am writing.
 
i need a c-function that can get me the size of the hd,
without using system(), via ftell and fseek i can determine the size of a file, but as soon as i try to use this on eg. dev/hda it all goes wrong,
in my programm the file is opened via low-level i/o,
it works perfectly as long as i open a single file, as soon as i try to open the /dev/hda it all goes wrong
 
That's because /dev/hda is a device, not a file. I guess you could take a look at df's source code, as it is open source. You could probably find what you need in there. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top