title: Move text cursor to new line
body: <p>I have a text file, that looks like this:</p>
  
  <pre><code>Name_of_st1 67 5  87 4  78 4
  Name_of_st2 89 5  56 3  79 4
  ...
  </code></pre>
  
  <p>I have written a program that reads the data and creates a vector of students with its own vector of subjects. The program reads the first line correctly, but when i ask it to write out name of second student, <code>std::cout</code> displays garbage. Here is the code:</p>
  
  <pre><code>struct Subject {
      int mark0;
      int mark1;
  };
  struct Student {
      char name[50];
      char surname[50];
      vector&lt;Subject&gt;my_marks;    
  };
  
  istream&amp; operator&gt;&gt;(istream&amp; is, Subject&amp; sub);
  istream&amp; operator&gt;&gt;(istream&amp; is, Student&amp; st);
  
  int main()
  try
  {
  
      ifstream ifs("Text.txt");
      vector&lt;Student&gt;group;
      Student s1, s2;
      ifs &gt;&gt; s1;
      group.push_back(s1);
      getline(ifs, temp);
      ifs &gt;&gt; s2;
      group.push_back(s2);
      cout &lt;&lt; group.size();
      cout &lt;&lt; group[0].name;
      cout &lt;&lt; group[0].surname;
      cout &lt;&lt; group[1].name;
      cout &lt;&lt; group[0].my_marks[1].mark0;
  
  }
  catch (exception&amp; e){
      cerr &lt;&lt; e.what() &lt;&lt; endl;
      return 1;
  }
  catch (...)
  {
      cerr &lt;&lt; "exception \n";
      return 2;
  }
  
  istream&amp; operator&gt;&gt;(istream&amp; is, Subject&amp; sub)
  {
      int m0, m1;
      is &gt;&gt; m0; 
      if (!is) return is;
      is&gt;&gt; m1;
      sub.mark0 = m0;
      sub.mark1 = m1;
      return is;
  }
  
  istream&amp; operator&gt;&gt;(istream&amp; is, Student&amp; st)
  {
          char n1[50];
          char n2[50];
          is &gt;&gt; n1;
          is &gt;&gt; n2;
          strcpy_s(st.name, n1);
          strcpy_s(st.surname, n2);
          if (!is) return is;
  
              while (true)
              {
                  Subject sub;
                  if (!(is &gt;&gt; sub)) break;
                  st.my_marks.push_back(sub);
              }
  
      return is;
  }
  </code></pre>
  
  <p>I have tried this, but still the same:</p>
  
  <pre><code> string temp
      ifs &gt;&gt; s1;
      getline(ifs, temp);
      group.push_back(s1);
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>char n1[50];
  char n2[50];
  
  for (int i = 0;; ++i)
  {
      char n0;
      is.get(n0);
      if (isspace(n0)) break;
      n1[i] = n0;
  }
  
  for (int i = 0;; ++i)
  {
      char n0;
      is.get(n0);
      if (isspace(n0)) break;
      n2[i] = n0;
  }
      if (!is) return is;
      strcpy_s(st.name, n1);
      strcpy_s(st.surname, n2);
  </code></pre>
  
  <p>Then i added <code>':'</code> after every Name of Student and used <code>is.get(n1, 100, ':')</code>.
  It still reads the first line correctly, but refuses to read the next. Whatever i did, i can`t move text cursor to the beginning of new line. If anyone can help me, i would appreciate it.</p>