As I understand it, the mode of a GPIO pin can be INPUT or OUTPUT (and I think there may be other modes such as PWM and I2C). I believe that the mode of a pin is a global and that if two applications attempt to set the mode, the last one called will be the actual final value.
My goal is to determine a pin's mode before attempting to set it or use it. This will allow me to detect potential conflicts.
Is there a way to determine the mode for a given pin? My programming library of choice is wiringPi but I am interested in any solution in this area just now.