I need to use fscanfto ignore all spaces and not keep it. I tried to use something like a combination between (*)and [^\n]how: fscanf(file," %*[^\n]s",);
Of course it crashed, is there any way to do this only with fscanf?
code:
int funct(char* name)
{
FILE* file = OpenFileToRead(name);
int count=0;
while(!feof(file))
{
fscanf(file," %[^\n]s");
count++;
}
fclose(file);
return count;
}
Solved! change the original fscanf()to
fscanf(file," %*[^\n]s"):; read the entire line exactly how fgets(), but did not save it!
source
share