2014年3月4日 星期二

改變wifi 無線網卡 , 連接ap

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
        char ssid[128];
        char cmd[128];

        strcpy(ssid , argv[1]);

        sprintf(cmd , "iwconfig wlan0 essid \"%s\"" ,ssid);

        system(cmd);

        system("udhcpc -i wlan0 -s /etc/udhcpc.script &");

        return 0;
}

沒有留言:

張貼留言