Changed line[strlen(line) - 1] = '\0'; to chomp(line);
This commit is contained in:
parent
30ac01cca7
commit
6e808ca354
@ -71,7 +71,7 @@ int sort_main(int argc, char **argv)
|
|||||||
|
|
||||||
while ((line = get_line_from_file(fp)) != NULL) {
|
while ((line = get_line_from_file(fp)) != NULL) {
|
||||||
lines = xrealloc(lines, sizeof(char *) * (nlines + 1));
|
lines = xrealloc(lines, sizeof(char *) * (nlines + 1));
|
||||||
line[strlen(line) - 1] = '\0';
|
chomp(line);
|
||||||
lines[nlines++] = line;
|
lines[nlines++] = line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
sort.c
2
sort.c
@ -71,7 +71,7 @@ int sort_main(int argc, char **argv)
|
|||||||
|
|
||||||
while ((line = get_line_from_file(fp)) != NULL) {
|
while ((line = get_line_from_file(fp)) != NULL) {
|
||||||
lines = xrealloc(lines, sizeof(char *) * (nlines + 1));
|
lines = xrealloc(lines, sizeof(char *) * (nlines + 1));
|
||||||
line[strlen(line) - 1] = '\0';
|
chomp(line);
|
||||||
lines[nlines++] = line;
|
lines[nlines++] = line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user