cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
COPY A LINES IN BINARY FILE
COPY A LINES IN BINARY FILE
May 14, 2015 at 8:59pm UTC
djimb
(2)
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);
}
Last edited on
May 15, 2015 at 1:04pm UTC
Topic archived. No new replies allowed.