How to pass up a struct edit[how to store lines]
<pre><code>this output

Andrew Tanenbaum, David Wetherall
    Computer Networks
    Michaell Donahoo, Kenneth Calvert
    TCP/IP Sockets in C
    William,Stallings
    Yale Patt, Sanjay Patel

is the result of this code.




#include &lt;stdio.h&gt;      /* for printf() and fprintf() */
#include &lt;sys/socket.h&gt; /* for socket() and bind() */
#include &lt;arpa/inet.h&gt;  /* for sockaddr_in and inet_ntoa() */
#include &lt;stdlib.h&gt;     /* for atoi() and exit() */
#include &lt;string.h&gt;     /* for memset() */
#include &lt;unistd.h&gt;     /* for close() */
#include "./book.h"
#ifndef fileget_C
#define fileget_C
#endif // fileget_C

 void readlib(Book* Library){
/*char stock[4][125];*/
  FILE *bookfile=fopen("/home/ninja/Sockets/bookstock.txt","r+");


  size_t len=0;
  int num;
  ssize_t read;
  char *stringin;
  char *isbn;
  int *numin;

int n;
  for(n=0; n&lt;4; n=n+1){
  getline(&amp;stringin, &amp;len, bookfile);
  strncpy(Library[n].isbn,stringin,strlen(stringin));
  //printf("%s",Library[n].isbn);
  stringin=NULL;

  getline(&amp;stringin, &amp;len, bookfile);
  strncpy(Library[n].Author,stringin,strlen(stringin));
  //printf("%s",Library[n].Author);
  stringin=NULL;

  getline(&amp;stringin, &amp;len, bookfile);
  strncpy(Library[n].title,stringin,strlen(stringin));
  //printf("%s",Library[n].title);
  stringin=NULL;

  getline(&amp;stringin, &amp;len, bookfile);
  num=atoi(stringin);
  Library[n].edition=num;
  //printf("%d\n",Library[n].edition);
  stringin=NULL;

  getline(&amp;stringin, &amp;len, bookfile);
  Library[n].year=atoi(stringin);
  stringin=NULL;
  //printf("%d\n",Library[n].year);

  getline(&amp;stringin, &amp;len, bookfile);
  strncpy(Library[n].publisher,stringin,strlen(stringin));
  stringin=NULL;


  getline(&amp;stringin, &amp;len, bookfile);
  Library[n].inventory=atoi(stringin);
  stringin=NULL;

  getline(&amp;stringin, &amp;len, bookfile);
  Library[n].available=atoi(stringin);
  //printf("%d\n",Library[n].available);

  }
 // printf("%s",Library[0].title);
  //printf("%s",Library[1].title);
  //printf("%s",Library[2].title);
  //printf("%s\n",Library[3].title);

  printf("%s",Library[0].Author);
  printf("%s",Library[1].Author);
  printf("%s",Library[2].Author);
  printf("%s",Library[3].Author);



}
</code></pre>

<p>For some reason, I'm getting extra lines stored or I am not storing to the pointer in an appropriate way. The commented out print lines in the for loop display the right information which includes printing the appropriate author field of the struct.</p>