I found a sample using libiw to perform a wifi ap scan which seems to be working, however I have a few different requirements which I need to be able to complete programmatically from C/C++:
1) Enable/Disable WIFI
2) Scan for available AP's
3) Connect and Disconnect from particular AP (including supplying password / key if required)
4) Create and Destroy an AD-HOC wireless network for clients to connect to in the absence of existing wi-fi.
I've had a look at various suggestions around d-bus, network manager(which doesn't seem to be the default on the pi) and this lib-iw which isn't really well documented.
Any help or pointers in the right direction on how to achieve the above from C would be greatly appreciated!