Ignoring lines in c++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main ()
{
string line,matrix;
ifstream myfile ("out");
if (myfile.is_open())
{
while (!myfile.eof() )
{
getline (myfile,matrix);
cout << matrix<< endl;
}
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
|
Hello With this code i could read all the lines from the input file.But i need to ignore some lines in the input file how to do that.
Topic archived. No new replies allowed.