title: Count the number of elements in txt file
body: <p>I have an assignment like this: </p>
  
  <pre><code>/*
  -   Read an input text file (.txt) contain one line to store an array of integer:
  Input.txt
  4 1 2 -100 -3 10 98 7
  -   Write SumList function to sum all integer data of the list
  -   Write a function to find the max of all integer data
  -   ...
  */
  </code></pre>
  
  <p>My question is how to count the number of numbers in the txt file to use 
  /for (int i = 0; i &lt; N; i++), N is number of numbers in file/ for reading the file. Or is there any way else to read this file without initializing N?
  Thank you!</p>