While trying to answer this question, I discovered the following strange issue with sscanf.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
    const char* lit ="George Washington, 2345678";
    char buffer[1024];
    int out = 0;
    memset(buffer, 0, 1024);
    sscanf(lit, "%50[^,]s, %d\n", buffer, &out);
    printf("%s %d\n", buffer, out);
}
The output of this code is George Washington 0.
Why is this and how can it be corrected?
 
    