fgets() will read a line from a file up to and including the linefeed:

Code:
FILE *in,*out;
char buf[100];  /* adjust for longest expected line */

in=fopen("test.txt","r") /* "rt" on Dos/Win */
out=fopen("output.txt","w");

while(fgets(buf,100,in)){
  /* do something with the line in buf */
  write(buf,100,out);
}
fclose(in);
fclose(out);