this program of mine is supposed to read input from the user via the keyboard. each sentence he types in, or each time he press enter, the sentence is stored into a node in the list.

Code:
struct list{
	char text[255];
	int num;
	struct list *next;
	struct list *prior;
} list_entry;

//code on reading inputing

printf("Enter file content (CTRL-Z to end) : \n");
	while(gets(s)){
		info = (struct list *)malloc(sizeof(list_entry));
		if(!info){
			printf("\nnot enough memory");
			return;
		}
		strcpy(info->text,s);
		printf("info : %s",info);
		listStore(info, &start, &last);
	}
	printf("\n");
            store();

//code on writing to a file
       if((cfPtr=fopen(file,"w"))==NULL)
	printf("File could not be opened\n");
       else{
	while(info){
		printf("info2:%s",info->text);
		fwrite(info,sizeof(struct list),1,cfPtr);
		fflush(cfPtr);
		info = info->next;
	}
	fclose(cfPtr);
	info = start;
	clearList(&info);
	printf("File saved\n");
         }

//methods
void listStore(struct list *i, struct list **start, struct list **last)
{
	struct list *p;

	p = *last;

	if(*last ==NULL){		//first element in list
		i->next = NULL;
		i->prior = NULL;
		i->num = 0;
		*last = i;
		*start = i;
		return;
	}
	else{
		p->next = i;
		i->next = NULL;
		i->prior = p;
		i->num = (p->num)+1;
		*last = i;
	}

}

//to view

clearList(&info);
printf("\nLoading File...\n");
	system("cls");
	int count=0;
	while(!feof(fp)){
		info = (struct list *)malloc(sizeof(list_entry));
		if(!info){
			printf("\nnot enough memory");
				return 0;
		}
		if(1!=fread(info, sizeof(struct list), 1, fp)break;
			printf("info3 :%s",info);
			listStore(info,&start,&last);
			num++;
			count++;
	}
	fclose(fp);
everything works fine, except one THING.....every time the user types more than 11 lines, that is 11 sentences, pressing ENTER 11 times, the lines after the 10 line doesn't show at ALL! What's weird is that the lines after 10 lines do get stored. when i open it, i find it there. But the >10 lines are separated by a huge GAP (pure spaces only) which i think could had caused this problem.

CAn anyone help me pls???
[code][/code]tagged by Salem