I got in a file bac.txt 2 different lines and I got to read both of them,what can I do in this situation?
            Asked
            
        
        
            Active
            
        
            Viewed 481 times
        
    -6
            
            
        - 
                    well I am not that skilled in these types of problems,I know how to read in stuff from a file,but still didn't learn how to read in different lines... – user3667865 May 23 '14 at 07:03
1 Answers
1
            
            
        You should use standard function std::getline with argument of type std::string and after that use std::istringstream to parse each line.
For example
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
//...
std::string line;
while ( std::getline( YourFile, line )
{
   std::istringstream is( line );
   // using `operator >>` to read items in the line
}
 
    
    
        Vlad from Moscow
        
- 301,070
- 26
- 186
- 335
