title: read data from file till end of line in C/C++
body: <p>It is common to read until end of file, but I am interested in how could I read data (a series of numbers) from a text file until the end of a <em>line</em>? I got the task to read several series of numbers from a file, which are positioned in new lines. Here is an example of input:</p>
  
  <pre><code>1 2 53 7 27 8
  67 5 2
  1 56 9 100 2 3 13 101 78
  </code></pre>
  
  <p>First series: 1 2 53 7 27 8</p>
  
  <p>Second one: 67 5 2</p>
  
  <p>Third one: 1 56 9 100 2 3 13 101 78</p>
  
  <p>I have to read them separately from file, but each one till the end of line. I have this code: </p>
  
  <pre><code>    #include &lt;stdio.h&gt;
      FILE *fp;
      const char EOL = '\\0';
      void main()
      {
          fp = fopen("26.txt", "r");
          char buffer[128];
          int a[100];
          int i = 0;
          freopen("26.txt","r",stdin);
          while(scanf("%d",&amp;a[i])==1 &amp;&amp; buffer[i] != EOL)
               i++;
          int n = i;
          fclose(stdin);
       }  
  </code></pre>
  
  <p>It reads until the end of the file, so it doesn't do quite what I would expect. What do you suggest?</p>