アプレットじこよう

1035 ワード

FILE *fp = NULL;
 char buf[256+1] = {0};
 
fp = fopen("/proc/bus/usb/devices","r");
 if(fp == NULL)
 {
  printf("%s %d  
",__FUNCTION__, __LINE__); return 1; } while(!feof(fp)) { fgets(buf,256,fp); if(buf == NULL) break; //printf("buf===[%s]
",buf); char *p = NULL; p = strstr(buf,"Ralink"); if(p) { fclose(fp); return 0; } } fclose(fp); return 1; char *cmd = "iwconfig ra0 |grep \"Link Quality\" > /tmp/wifi_quality"; FILE *fp = NULL; char buf[256+1] = {0}; char quality[5] = {0,}; fp = fopen("/tmp/wifi_quality","r"); while(!feof(fp)) { fgets(buf,256,fp); if(buf == NULL) break; char *p = NULL; p = strstr(buf,"Link Quality"); if(p) { fclose(fp); int i = 0; int k = 0; for(i=0;i