There is no such function that retrieves IP address. However you can get it using several strokes of code (ioctl etc.). Simply download "ifconfig" source code and take it from it.