How does the code below work ? where is the counter for the for-loop and how can i reset the counter to line number 0.
for (std::string line;std::getline(ifs, line); )
{
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no need for a counter. This is equivalent to
There are methods to move the input iterator back to the beginning of the file. Something like:
ifs.seekg(0, std::ios::beg);should do the trick.