I am reading in a 2mb mixed file (i.e. contains CFLF and LF) and non-standard characters. Now, at the start of the program the file is redirected into stdin from the command prompt. The problem is the file is never fully read.

It gets to a certain point in the file and decides that its at the end of the file! How can I solve this issue?

Sample code (not the actual code of my program as this is an assignment). Note that in the assignment specs it explicitly states that this is a text file that we are reading.

running from command prompt:

prog < file > output

Code:
#define READ_LINE_SIZE 1024
...
char *buf = (char *)malloc(sizeof(char) * READ_LINE_SIZE);
while (!feof(stdin))
{     
   fgets(buf, READ_LINE_SIZE, stdin);
   printf("%s", buf);
}
free(buf);