Advertisement
Guest User

Parsing v0.5

a guest
Dec 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include <stdlib.h>
  5. #include <numeric>
  6.  
  7.  
  8. using namespace std;
  9.  
  10.  
  11.  
  12.  
  13. int main() {
  14. string line, dollar, star, Checksum;
  15. float *t0 = NULL;
  16. int tount = 0;  
  17. int k;
  18.  
  19.     ifstream logs_("C:/Users/Dmitry/Desktop/testlog.txt");
  20.     ofstream tout("outLOGTime.txt");
  21.     ofstream pout("outLOGPot.txt");
  22.     if (logs_.is_open())
  23.     {
  24.         while(getline(logs_,line))
  25.         {  
  26.             //line.find("RE004%on%")
  27.             k = 0;
  28.  
  29.             if(line.substr(0,6) == "$GPGGA", "$GPGSV")
  30.              
  31.                 dollar = line.find_first_of('$');
  32.                 star = line.find_first_of('*');
  33.                 for ( string::iterator c=dollar.begin(); c!=star.end(); ++c)
  34.                     {
  35.                     accumulate(c, 0, bit_xor<unsigned char>()) )
  36.                     }
  37.  
  38.  
  39.                 if (line.substr(0,6) == "$GPGSV")
  40.                 {
  41.                     for (size_t i = 0, N = 7; i < line.size(); i++)
  42.                     {
  43.                         if (line[i] == ',') k++;
  44.                         if(k == N)
  45.                         {
  46.                         pout << line.substr(i+1, 2) << endl;
  47.                         if ((N += 4) > 19) break;
  48.                         }
  49.                     }
  50.  
  51.                 }
  52.  
  53.         logs_.close();
  54.  
  55.         }
  56.     }
  57.     else
  58.         cout<<"File is not open"<<'\n';
  59.     tout.close();
  60.     pout.close();
  61.  
  62.     return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement