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.