Code:
#define MAX_LEN /*whatever you think appropriate */
char str[MAX_LEN];
fscanf("%[^\n]\n", str);
while(str != EOF)
{
counter++;
fscanf("%[^\n]\n", str);
}
str is a reserved name, fscanf doesn't have the correct arguments, str will never be EOF, and the whole %[^\n]\n format is just nasty. Even with the errors fixed this code wouldn't give the correct output, perhaps something more like this:
Code:
#define MAX_LEN /*whatever you think appropriate */
char fstr[MAX_LEN];
while ( fgets ( fstr, sizeof fstr, file ) != NULL )
counter++;
-Prelude