char buf[BUFSIZE];

fgets(buf, BUFSIZE, stdin);
if (strchr(buf, '\n') == NULL)
while (fgetc(stdin) != '\n');
fgets(buf, BUFSIZE, stdin);