? Linux ?,gets()
????????,???????????????,?????????
-
??
fgets()
??gets()
:fgets()
????????????????,??????????????:char buffer[256]; fgets(buffer, sizeof(buffer), stdin);
-
??
getline()
??(GNU ??):getline()
???????????????????????,getline()
? GNU ??,???? GNU ???????#include
#include int main() { char *line = NULL; size_t len = 0; ssize_t read; while ((read = getline(&line, &len, stdin)) != -1) { printf("Read: %s", line); } free(line); return 0; } -
??
scanf()
?????????: ??%
????????????????????:char buffer[256]; scanf("%5s", buffer);
???,?????????????????,???????????????????????,????????