title: How to read a .txt file into C array line by line?
body: <p>i have a .txt file named <code>Members.txt</code> which contain:</p>
  
  <pre><code>2
  Rebaz salimi 3840221821 0918888888
  Hojjat Qolami 2459816431 09177777777
  </code></pre>
  
  <p>i had written a C file to read <code>Members.txt</code> into <code>char w[100];</code> array like:</p>
  
  <pre><code>int main()
  {
         int i = 0, line = 5;
         char w[100];
         char f[20];
         char k[15];
         FILE *myfile;
                        myfile = fopen("Members.txt","r");
                        if (myfile== NULL)
                        {
                         printf("can not open file \n");
                         return 1;
                        }
  
       while(line--){
                     fscanf(myfile,"%s",&amp;w[i]);
                     i++;
                     printf("\n%s", &amp;w[i]);
                    }
                     fclose(myfile);
          return 0;
  }
  </code></pre>
  
  <p>but ,i need every newline of<code>Members.txt</code> to be saved into different array line by line.</p>