- #1
Nate Duong
- 126
- 3
Dear group,
I am using Eclipse in the Ubuntu operation system and trying to print out this data from the begin to the string "END OF HEADER" but I do not understand why it did not give me the one as I expected.
I also used this file "albe0320_1.17n" to test and it worked, but the file that I am trying to use is "GANP00SVK_R_20160100000_01D_EN.rnx" and did not work and the data still stucking in the while loop. 2 these data files have exactly the same format, but maybe different tail format, such as: ".17n" and "rxn" I do not know how to get this out.
If anyone whoever can help, I appreciated for that help!
Here are my code and attached data file.
Thank you very much.
Very best regards.
I am using Eclipse in the Ubuntu operation system and trying to print out this data from the begin to the string "END OF HEADER" but I do not understand why it did not give me the one as I expected.
I also used this file "albe0320_1.17n" to test and it worked, but the file that I am trying to use is "GANP00SVK_R_20160100000_01D_EN.rnx" and did not work and the data still stucking in the while loop. 2 these data files have exactly the same format, but maybe different tail format, such as: ".17n" and "rxn" I do not know how to get this out.
If anyone whoever can help, I appreciated for that help!
Here are my code and attached data file.
Thank you very much.
Very best regards.
C:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstring>
#include <string>
#include <sstream>
#include <csignal>
#include <cstdio>
using namespace std;
const int MAX_CHARS_PER_LINE = 81;
nt main () {
string filename = "GANP00SVK_R_20160100000_01D_EN.rnx";
ifstream fin;
fin.open(filename.c_str());
int head_lines = 0;
std::string header_end =("END OF HEADER");
char line[MAX_CHARS_PER_LINE];
while (1) // scanning data per line until hit the message "END OF HEADER"
{
head_lines++;
fin.getline(line, MAX_CHARS_PER_LINE);
std:: string line1(line);
std::size_t found = line1.find(header_end);
if (found!=std::string::npos)
{
break;
}
}
cout << "done!"<<endl;
return 0;
}
Attachments
Last edited: