L
leorulez
Hi all
I need to read the number of non-empty lines in a text file
char c[100];
int i=0,j=0;
while( !feof( fp1 ) )
{
fgets( c , 100 , fp1);
while( ( c[ i ] == ' \n' )
j++;
i++;
}
printf("number of non-empty lines=%d", i-j);
For some reason this code is not working. The c[ i ] == ' \n' is not
getting satisfied at all. Is there anything that I am missing?
Thanks in advance!
I need to read the number of non-empty lines in a text file
char c[100];
int i=0,j=0;
while( !feof( fp1 ) )
{
fgets( c , 100 , fp1);
while( ( c[ i ] == ' \n' )
j++;
i++;
}
printf("number of non-empty lines=%d", i-j);
For some reason this code is not working. The c[ i ] == ' \n' is not
getting satisfied at all. Is there anything that I am missing?
Thanks in advance!