read specific number of chars in c [closed]

Only if you googled it…

char buf[11];
fgets(buf, sizeof(buf), stdin);

11 char = 10 char plus the terminating NUL.

Leave a Comment