Results 1 to 5 of 5
Does any body knows how to find hard disk information using c proramg, like Total Size of disk, mounted partitions, unmounted partitions, unused size , serial no etc....
- 08-29-2006 #1Just Joined!
- Join Date
- Aug 2006
- Posts
- 48
How to get Hard Disk Info Using C program
Does any body knows how to find hard disk information using c proramg, like Total Size of disk, mounted partitions, unmounted partitions, unused size , serial no etc.
- 08-30-2006 #2
procfs is your friend

Surf /proc and see partitions file and ide directory... and read the procfs documentation that comes with the kernel source.
Best regards
- 08-30-2006 #3Just Joined!
- Join Date
- Aug 2006
- Posts
- 48
without using /proc pshedo file system i want to know the stuff using c proram.
- 08-31-2006 #4
The way you should gather system information is using procfs. It is it's purpose.
In addition, you have two alternatives:
- Execute the sysctl command: This is really dirty.
- Use the sysctl system call: If you carefully read the man page, at the bottom, you can find this:
The object names vary between kernel versions. THIS MAKES THIS SYSTEM CALL WORTHLESS FOR APPLICATIONS. Use the /proc/sys interface instead.
Although it's possible to gather the information that you want by means of other system calls / functions, using procfs is what top, ps and other tools do. (and I'm not sure, but free and df probably do too)
Best Regards
- 08-31-2006 #5Just Joined!
- Join Date
- Aug 2006
- Posts
- 48
Thanks for ur reply
Thanks for ur reply


Reply With Quote
