DEV Community

aiana-exe
aiana-exe

Posted on

result = fscanf(fp, "%[^\n]%*c", ap->name); The %*c specifier

One problem with this:

result = fscanf(fp, "%[^\n]s", ap->name);

is that you have an extra s at the end of your format specifier. The entire format specifier should just be %[^\n], which says "read in a string which consists of characters which are not newlines". The extra s is…

Top comments (1)

Collapse
 
aianaexe profile image
aiana-exe

says to read in a character (c), but don't assign it to any variable (*).