So. . . this is a very good example that shows how one would, or could wrap the gpio sysfs files. This:
fs.open("/sys/kernel/debug/omap_mux/gpmc_ad4");
fs << "7";
May be incorrect for current kernel / file system structure, but I can tell you what this bit of code is going. It's simply muxing the pin he / she want to control in code. 0x7 == pin mux for GPIO mode. So you( we ) can either figure how do do this with modern debian images, or "we" could simply mu our pins with config-pin( universal IO ) or device tree overlay.
Personally, since I've been experimenting with Charles' universal-io overlays and config-pin recently, and in my spare time. I'm favoring that lately. Also, that script is very easily wrapped in code as well. Anyway, once the pin it muxed for the correct mode, the rest of that code would( should ) simply work.
fs.open("/sys/class/gpio/export");
fs << "32";
fs.close();
This is exactly as if you echo "32" into /sys/class/gpio/export. Which exports the pin.
fs.open("/sys/class/gpio/gpio32/direction");
fs << "out";
fs.close();
Exactly like echoing "out" into /sys/class/gpio/gpio32/direction. Which configures the pin as output.
fs.open("/sys/class/gpio/gpio32/value");
fs << "1";
fs.close();
Exactly the same as echoing "1" into
/sys/class/gpio/gpio32/value. Which makes the pin output, and high.
Any further questions ?