What is LINE here?

Hello!
Is here "line" just identificator for a string?

1
2
3
4
5
6
7
8
9
10
   string line;
  ifstream myfile ("example.txt");
  if (myfile.is_open())
  {
    while ( getline (myfile,line) )
    {
      cout << line << '\n';
    }
    myfile.close();
  }
What if we have more lines in a file?
Do they all have the same name ("line" in that case?)

Many thanks!!!
line is the name of the std::string variable. You could call the variable whatever you want but the name makes sense because you use it to store the content of a file line. The content of the line variable will change and will be different in each iteration of the loop.
Last edited on
Thanks!
Topic archived. No new replies allowed.