Does it have any command to get iPaddress for wifi

Code

char* wifi_AskForIpAddress()
{
    int  systemResult;
    //char tmpString[512];
#ifdef DEBUG    
    printf("=== ASK FOR IP ADDRESS === \n");
#endif
    // DHCP client
    snprintf(tmpString,
        sizeof(tmpString),
        "PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin;"
        "/sbin/udhcpc -R -b -i wlan0"
   );

    systemResult = system(tmpString);
    // Return value of -1 means that the fork() has failed (see man system).
    if (0 == WEXITSTATUS(systemResult))
    {
		return tmpString;
#ifdef DEBUG    
        printf("DHCP client: %s \n", tmpString);
    }
    else
    {
        printf("DHCP client %s Failed: (%d) \n", tmpString, systemResult);
#endif
    }
	return NULL;
}

I want to get the output IP-Address in the char from?

here is a C program example

it was error

char* wifi_AskForIpAddress()
{
    int  systemResult;
    //char tmpString[512];
	 int fd;
	 struct ifreq ifr;
#ifdef DEBUG    
    printf("=== ASK FOR IP ADDRESS === \n");
#endif
    // DHCP client
    snprintf(tmpString,
        sizeof(tmpString),
        "PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin;"
        "/sbin/udhcpc -R -b -i wlan0"
   );

    systemResult = system(tmpString);
    // Return value of -1 means that the fork() has failed (see man system).
    if (0 == WEXITSTATUS(systemResult))
    {
		fd = socket(AF_INET, SOCK_DGRAM, 0);

		 /* I want to get IP address */
		 ifr.ifr_addr.sa_family = AF_INET;

		 /* I want IP address attached to "wlan0" */
		 strncpy(ifr.ifr_name, "wlan0", IF_NAMESIZE-1);

		 ioctl(fd, SIOCGIFADDR, &ifr);

		 close(fd);

		 /* display result */
		 printf("%s\n",inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
		 //strncpy(tmpIPadd, inet_ntoa(((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr));
		return tmpString;
#ifdef DEBUG    
        printf("DHCP client: %s \n", tmpString);
    }
    else
    {
        printf("DHCP client %s Failed: (%d) \n", tmpString, systemResult);
#endif
    }
	return NULL;
}

you can ask in this link as the code is come from there:

I can use $CC -o to make app but mkapp it was error.
anyway to fix?

mkapp is for legato app, not for pure linux application binary