I have some code reading a text file and scanning for words between brackets: ‘[‘ and ‘]’.
When I find the line starting with a ‘[‘ I read the string with:
line[64] = "[word]";
sscanf(line, "[%s]", resource);
printf("%s\n",resource);
==> word]
but I always end up with the string+the bracket. How can i format sscanf to only read the string without the bracket at the end?
Exclude the
]from the set of characters thescanf()reads: