Quote:
Originally Posted by endfx
char *line[5];
You want char line[5] for an array of chars. You are declaring an array of pointers to chars then reading 4 bytes into the first pointer and storing zero in the last pointer then passing the address of the first pointer to printf (with %s) and it prints chars until it happens to find a zero.

Also, sizeof(char) is always 1 since the sizeof operator returns sizes in multiples of the size of a char (which I believe is supposed to represent the smallest addressable unit of memory on the machine, which on PCs is 1 8-bit byte).

fgets is more appropriate for reading chars.

P.S., remember to use a code block next time to properly display your code.