...
| Code Block | ||
|---|---|---|
| ||
char buf[BUFSIZ + 1]; if (fgets(buf, sizeof(buf), fpstdin)) { if (*buf) { /* see FIO37-C */ buf[strlen(buf) - 1] = '\0'; } } else { /* Handle error condition */ } |
...
| Code Block | ||
|---|---|---|
| ||
char buf[BUFSIZ + 1]; char *p; if (fgets(buf, sizeof(buf), fpstdin)) { p = strchr(buf, '\n'); if (p) { *p = '\0'; } } else { /* handle error condition */ } |
...