You want to use the sysfs interface to GPIOs
http://www.kernel.org/doc/Documentation/gpio.txt
In that link search for "Sysfs Interface for Userspace"
I have no idea what type of system you are on, or if support for this is already enabled in your kernel or not, but that is where you want to look.