c++ - Getting SSID and BSSID from a file in efficent way -


i have file called network.txt have ssid , bssid below

ssid                              bssid               mode             freq       rate       signal   security   active 'bards tale'                  30:da:9b:70:ee:f4   infrastructure   2412  mhz   54 mb/s    47       wpa2              no 'alaskan pale'                70:37:73:b7:3a:53   infrastructure   2412 mhz   54 mb/s    44       wpa2             yes 'abita turbodog'              9c:1e:04:4c:59:fc   infrastructure   2412 mhz   54 mb/s    7        wpa wpa2         no 'alaskan amber'               12:62:eb:2c:c0:06   infrastructure   2422 mhz   54 mb/s    2        wpa wpa2         no ~                                              

i want ssid , bssid in safe , efficient way below approach working fine can improve ?

  void getssidandbssid(const std::string &temp)     {         if (temp.find("'") != std::string::npos)         {              std::string::size_type end_pos = temp.find_last_of(":");             if (end_pos == std::string::npos)                 end_pos = temp.size();       std::string firstword = temp.substr(1, end_pos+2);      std::cout <<"ssid="<< firstword.substr(0,temp.find_last_of("'")-1) << std::endl;    std::cout<<"bssid=" << firstword.substr(temp.find_first_of(":")-2,temp.find_last_of(":")+2) << std::endl;         }     }   int main() {         ifstream fin("pathto/network.txt");         std::string line;         while(getline(fin,line))         {                  getssidandbssid(line);          } 

can code improved ?


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -