}
lines--;
- fs = (struct file_size *)realloc(fs, lines * sizeof(struct file_size));
if(ignore != NULL)
fclose(ignore);
rest[restcount++] = input[i];
}
}
+ restcount--;
fclose(out);
printHumanReadSize(output, splitgroesse);
if(restcount > 0) {
memcpy(input, rest, length * sizeof(struct file_size));
- input = (struct file_size *)realloc(input, restcount * sizeof(struct file_size));
}
free(rest);
- // -1 weil vor Schleifenende nochmal incrementiert wird
- return restcount - 1;
+ return restcount;
}
int main(int argc, char *argv[])
int s_length = get_array_length(in);
struct file_size *fs = (struct file_size *)malloc((s_length + 1) * sizeof(struct file_size));
s_length = fill_array_from_file(in, fs, split);
+ fs = (struct file_size *)realloc(fs, s_length * sizeof(struct file_size));
fclose(in);
// sortieren
while(s_length > 0) {
sprintf(outname, "%s%03d", output, num++);
s_length = splitter(fs, outname, split, s_length);
+ fs = (struct file_size *)realloc(fs, s_length * sizeof(struct file_size));
}
free(fs);