- #1
Nate Duong
- 126
- 3
Hi Group,
I am trying to get data from text file, I hope someone can suggest me how to do?
I also have this code which can read data, but i do not know how to scan every single line to get any information I want.
Please help, Thank you very much.
Here is my code:
and the file is attached:
#cP2016 10 12 0 0 0.00000000 96 ORBIT IGb08 HLM IGS
## 1918 259200.00000000 900.00000000 57673 0.0000000000000
+ 32 G01G02G03G04G05G06G07G08G09G10G11G12G13G14G15G16G17
+ G18G19G20G21G22G23G24G25G26G27G28G29G30G31G32 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 2 2 2 0 2 2 2 2 2 2 2 3 2 2 2 2 2
++ 2 3 2 2 2 2 2 2 2 2 3 3 2 2 2 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
%c G cc GPS ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%f 1.2500000 1.025000000 0.00000000000 0.000000000000000
%f 0.0000000 0.000000000 0.00000000000 0.000000000000000
%i 0 0 0 0 0 0 0 0 0
%i 0 0 0 0 0 0 0 0 0
/* RAPID ORBIT COMBINATION FROM WEIGHTED AVERAGE OF:
/* cod emr esa gfz jpl ngs sio usn whu
/* REFERENCED TO IGS TIME (IGST) AND TO WEIGHTED MEAN POLE:
/* PCV:IGS08_1915 OL/AL:FES2004 NONE Y ORB:CMB CLK:CMB
* 2016 10 12 0 0 0.00000000
PG01 -13708.647442 10773.249185 19862.568314 36.889073 5 6 6 115
PG02 13719.486776 13609.232181 -17921.238464 541.110472 10 9 8 125
PG03 -23066.347494 13143.568797 580.431793 -92.017995 7 6 8 141[/code]
I am trying to get data from text file, I hope someone can suggest me how to do?
I also have this code which can read data, but i do not know how to scan every single line to get any information I want.
Please help, Thank you very much.
Here is my code:
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <boost/lexical_cast.hpp> // convert number to string
using namespace std;int main ()
{
string input = "test1.txt";
string line;
ifstream fin(input.c_str());
if (fin.is_open())
{
/* while ( getline (fin, line) )
{
cout << line << '\n';
}*/
while (! fin.eof() )
{
getline (fin,line);
cout << line << endl;
}
fin.close();
}
else cout << "System can not read the input file, check it again.";
}
cout << "Done!" << endl;
return 0;
}
#cP2016 10 12 0 0 0.00000000 96 ORBIT IGb08 HLM IGS
## 1918 259200.00000000 900.00000000 57673 0.0000000000000
+ 32 G01G02G03G04G05G06G07G08G09G10G11G12G13G14G15G16G17
+ G18G19G20G21G22G23G24G25G26G27G28G29G30G31G32 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 2 2 2 0 2 2 2 2 2 2 2 3 2 2 2 2 2
++ 2 3 2 2 2 2 2 2 2 2 3 3 2 2 2 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
++ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
%c G cc GPS ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%c cc cc ccc ccc cccc cccc cccc cccc ccccc ccccc ccccc ccccc
%f 1.2500000 1.025000000 0.00000000000 0.000000000000000
%f 0.0000000 0.000000000 0.00000000000 0.000000000000000
%i 0 0 0 0 0 0 0 0 0
%i 0 0 0 0 0 0 0 0 0
/* RAPID ORBIT COMBINATION FROM WEIGHTED AVERAGE OF:
/* cod emr esa gfz jpl ngs sio usn whu
/* REFERENCED TO IGS TIME (IGST) AND TO WEIGHTED MEAN POLE:
/* PCV:IGS08_1915 OL/AL:FES2004 NONE Y ORB:CMB CLK:CMB
* 2016 10 12 0 0 0.00000000
PG01 -13708.647442 10773.249185 19862.568314 36.889073 5 6 6 115
PG02 13719.486776 13609.232181 -17921.238464 541.110472 10 9 8 125
PG03 -23066.347494 13143.568797 580.431793 -92.017995 7 6 8 141[/code]
Attachments
Last edited: