I need to use fscanf
to ignore all the white spaces and to not keep it.
I tried to use something like the combination between (*)
and [^\\n]<
Using a space (" ") in the fscanf format causes it to read and discard whitespace on the input until it finds a non-whitespace character, leaving that non-whitespace character on the input as the next character to be read. So you can do things like:
fscanf(file, " "); // skip whitespace
getc(file); // get the non-whitespace character
fscanf(file, " "); // skip whitespace
getc(file); // get the non-whitespace character
or
fscanf(file, " %c %c", &char1, &char2); // read 2 non-whitespace characters, skipping any whitespace before each
from:
Ignoring whitepace with fscanf or fgets?