Hi all, newb here ! I'm working on a project and having some problem. Once I can get rid of this prob I'll be in business !

I need to open a file named books.txt which contains a number of line we don't know. There's one information per line and each group of 6 lines forms a struct.

Right now the file is opened correctly and I'm able to read each line and print them in a new file. My problem is to insert each struct (which are made of 6 consecutive lines) as an item in my array.

Code:
for(i=0, j=0; c[i]!='\t'; i++, j++) {
/* this keeps looping until a tab character is reached */
books[num_books].title[j] = c[i];
}

/* add a null character to terminate string */
books[num_books].title[j] = '\0';

When reading a line in the file books.txt, this is how I currently assign a value to a field of the struct infoBook. Then, when the struct is completed (with the 6 fields having value), I need to add this struct to the array books, which I'm not able right now I'm not sure my structure is correct, but I tried regrouping all the info I learned so far...

Here's my function
Code:
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"

struct book
{
char title[80];
char autor[40];
char editor[20];
char ISBN[10];
char subject[20];
int release;
};
typedef struct book bookInfo;


int main()
{
char x[50];
FILE *file; //file opened
infoLivre *books; // array of struct of undefined length
int num_books = 0;
int i, j;

file = fopen("books.txt", "r");
if(file==NULL) {
printf("Error: can't open file.\n");
return 1;
}
else {
while (!feof(file)){

if(num_books==0) {
books = calloc(1, sizeof(infoLivre));
}
else {
books = realloc(books, (num_books+1)*sizeof(bookInfo));
}

/* now try to store relevant info in our struct field.
can do it character at a time as sscanf won't work as
it falls apart with spaces between names */

for(i=0, j=0; c[i]!='\t'; i++, j++) {
/* this keeps looping until a tab character is reached */
books[num_books].title[j] = c[i];
}

/* add a null character to terminate string */
books[num_books].title[j] = '\0';

for(i++, j=0; c[i]!='\t'; i++, j++) {
books[num_books].autor[j] = c[i];
}
books[num_books].autor = '\0';


for(i++, j=0; c[i]!='\0' && c[i]!='\n'; i++, j++) {
/* store the gender but ignore the last newline character */
books[num_books].editor[j] = c[i];
}

books[num_books].editor[j] = '\0';

num_books++; /* keep track of how many we stored */
}
fclose(file); /* close file */

return 0;
}
}