I spent the past hour trying to figure out why
char buffer[101];
scanf("%100[^\n]", buffer);
works as intended, reading a string until in encounters a newline, while
char buffer[101];
scanf("%100[^\n]\n", buffer);
does not return after pressing Enter.
Explicitly flushing the input buffer with CtrlD (in linux) immediately after pressing Enter seems to fix the problem, forcing the scanf to return. Am I missing something here?