Conversion binary to text and copy some lines (any help??)

Dear All,

I would like to use a code to extract some lines in binary file and send the result to a ini file. when I try with this code and use a simple word "param" I don't get any thing

I would like your help

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

bool isWanted(const std::string & line);

int main()
{
ifstream fin("Test.txt");

string line;
while (getline(fin, line))
{
if (isWanted(line))
cout << line << endl;
}
return 0;
}
bool isWanted(const std::string & line)
{
// any selection criteria you like
return (line.find("two") != string::npos);
}
First of all, please wrap your code in the code tags.

Secondly, you are not testing that your ifstream is in fact open: Use fin.bad(), etc.

Thirdly, what does your input data look like?
Topic archived. No new replies allowed.