LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   C : get drive/partitions list (https://www.linuxquestions.org/questions/programming-9/c-get-drive-partitions-list-332880/)

cantabile 06-12-2005 07:01 PM

C : get drive/partitions list
 
HI,
I'd like to retrieve drives and partitions in C language. I know I can read /proc/partitions (or mtab), but I'd like to learn the C way to access hardware in Linux.
Would you have a link website, book; etc. ?
Thanks for your help.

lowpro2k3 06-13-2005 12:37 AM

Wait for more experienced programmers, but I think thats a kernel land thing, not a user land thing. It depends what you mean by "access hardware", but generally you'd want to look into kernel programming in C?

I'm just trying to learn the Linux environment at the moment, generally working in user space. You might want to get started with the Linux Kernel Module Programming Guide that I've seen updated lately on tldp.

EDIT: I just looked at the guide a bit more, it might not be the best guide for a single task - like accessing your HDD, but you might still be interested.

itsme86 06-13-2005 12:55 AM

Is this helpful?
http://www.ussg.iu.edu/hypermail/lin...04.2/0345.html

First site I found on google with partitions ioctl as the search.

cantabile 06-13-2005 09:57 AM

Thanks, both of you, for your help. I have a good starting point. I'll try and read partitions.c in kernel sources to see how it is done. :)


All times are GMT -5. The time now is 03:55 PM.