Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

reading in lines from a file to a vector c++

std::string str;
// Read the next line from File untill it reaches the end.
while (std::getline(in, str))
{
    // Line contains string of length > 0 then save it in vector
    if(str.size() > 0)
        vecOfStrs.push_back(str);
}
 
PREVIOUS NEXT
Tagged: #reading #lines #file #vector
ADD COMMENT
Topic
Name
6+8 =