Scan for available wifi on interface

My app need to retrieve a list of available wifi. On the command line I would use iwinfo scan. Is there an API to achieve the same thing in C?