I have a text file with one number in each line.
I want to read a specific number of lines from this file , lets say the first 20, what is the way to do it?
I have the following piece of code.
FILE *ft;
ft=fopen(filename,"r");
for(int k=1; k<Nt+1; k=k+1) 
{
    fscanf(ft,"%lf\n",&curve3[k]);
    printf("%lf\n",curve2[k]);
}
EDIT: I changed my code to
FILE *ft;
ft=fopen(filename,"r");
int k=1;
while(!feof(ft))
{
    if(k<=Nt)
    {
        fscanf(ft,"%lf\n",&curve2[k]);
        //printf("%lf\n",curve2[k]);
    } 
    k=k+1;
}
It still doesn't seem to work.
 
     
    