read from file only from one specific line to another C++ -


Is there any way to read the data in the second line from the file?

For example:

In these lines:

Line 1: Empty row

Line Line line: blank line

Line 3: Robert W.

Line 4: Take the frank

Line 5: Sylvia ops

Line 6: Blank line

Line 7: Blank line

Line 8: Andy SF

And I only have to read from line 3 to line 6

Then the output will be: Robert V Frank le Sylvia op

and my file has 300 lines

thanks

class = "post-text" itemprop = "text">

This should do the trick:

 < Code> #include & lt; Iostream & gt; # Include & lt; Fstream & gt; #include & lt; String & gt; using namespace std; Int main () {string line; Infinite Infile; Infile.open ("putyourinputfilehere.txt"); While (Getline (Infail, Line)) {if (line! = "") {Cout & lt; & Lt; Line & lt; & Lt; Endl; }} Infile.close (); Return 0; }    

Comments

  1. We are one of the most safe and reliable packers and movers in Surat & Vadodara because we take pride in delivering the best of house shifting services, office shifting services at a most affordable charges.



    Packers and Movers in Surat
    Packers and Movers in Vadodara

    ReplyDelete

Post a Comment

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -