title: Read File line by line to variable and loop
body: <p>I have a phone.txt like:</p>
  
  <pre><code>09236235965
  09236238566
  09238434444
  09202645965
  09236284567
  09236235965
  ..and so on..
  </code></pre>
  
  <p>How can I process this data line by line in C++ and add it to a variable.</p>
  
  <pre><code>string phonenum;
  </code></pre>
  
  <p>I know I have to open the file, but after doing so, what is done to access the next line of the file?</p>
  
  <pre><code>ofstream myfile;
  myfile.open ("phone.txt");
  </code></pre>
  
  <p>and also about the variable, the process will be looped, it will make the <code>phonenum</code> variable the current line its processing from the phone.txt.</p>
  
  <p>Like if the first line is read <code>phonenum</code> is the first line, process everything and loop; now the <code>phonenum</code> is the 2nd line, process everything and loop until the end of the last line of the file.</p>
  
  <p>Please help. I'm really new to C++. Thanks.</p>