title: Read file .txt and save it to struct in c
body: <p>I want to ask about file processing and struct in C language, I get an assignment from my lecture, and am so really confused about string manipulation in C programming. Here is the task.</p>
  
  <ol>
  <li>get data from <strong>mhs.txt</strong></li>
  <li>store in <strong>struct</strong></li>
  <li><strong>sort</strong> by name ascending</li>
  </ol>
  
  <p>Here is the mhs.txt</p>
  
  <pre class="lang-none prettyprint-override"><code>1701289436#ANDI#1982
  1701317124#WILSON#1972
  1701331734#CHRISTOPHER STANLEY#1963
  1701331652#SHINVANNI THEODORE#1962
  1701331141#MUHAMMAD IMDAAD ZAKARIA#1953
  1701331564#MARCELLO GENESIS DRIET J.#1942
  1701322282#ANANDA AULIA#1972
  1701329175#LORIS TUJIBA SOEJONOPOETRO#1983
  1701301422#DEWI JULITA#1993
  1701332610#HARRY HUTALIANG#1982
  </code></pre>
  
  <p>first before # is NIM, 
  after first # is name
  and the last after #, is year</p>
  
  <p>and here is what i've done</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  struct student{
      char nim[11];
      char name[50];
      int year;
  }s[10];
  int main(){
      FILE *fp;
      int c,i,n;
  
      printf("Read mhs.txt...");
      getchar();
  
      fp  = fopen("mhs.txt", "r");
      c   = getc(fp);
      i   = 0;
      while(c!=EOF){
          printf("%c", c);
          c           = getc(fp);
          i++;
      }
      fclose(fp);
      getchar();
      return 0;
  }
  </code></pre>
  
  <p>First thing, I could save data on struct, but in here I very confused to separate a string.</p>
  
  <p>That's all I know about struct and file processing, is there anyone who can help me? I have traveled around the internet and could not find the correct results.</p>
  
  <p>Sorry if there are duplicate questions, and sorry if my english is too bad.</p>