I also need a suitable code to use NDK as Android lib

I also need a suitable code to use NDK as Android lib

I saw them call this function in Android open source

What do you think of this code?

int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
                 char *reply, size_t *reply_len,
                 void (*msg_cb)(char *msg, size_t len))
                {
        DWORD written;
        DWORD readlen = *reply_len;

if (!WriteFile(ctrl->pipe, cmd, cmd_len, &written, NULL))
    return -1;

if (!ReadFile(ctrl->pipe, reply, *reply_len, &readlen, NULL))
    return -1;
*reply_len = readlen;

return 0;

}

This is link

resolvent:

You can try running the command, output the result to a file, and then read it

system("iwconfig > temp.txt");
FILE *fp=fopen("temp.txt","w");

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>