How do I read and print just n(10) lines in a file and not whole file.
#include<stdio.h>
#include<string.h>
int main()
{
char line[50];
FILE *datafile;
datafile = fopen("/data3", "r");
while(fgets(line,sizeof line,datafile)!=NULL)
printf(" %s\n", line);
fclose(datafile);
return 0;
}