splitgroesse, humanread, einheit);
}
-
-
int cmpfunc(const void *filea, const void *fileb)
{
long long unsigned int a = ((const struct file_size*)filea)->fsize;
int splitter(struct file_size *input, const char *output,
unsigned long long splitgroesse, int length)
{
- struct file_size *rest = (struct file_size *)malloc(length * sizeof(struct file_size));
+ struct file_size *rest = (struct file_size *)
+ malloc(length * sizeof(struct file_size));
+
unsigned long long filesize = 0;
char *filename;
int restcount = 0;
// Liest die Quelldatei in den Ram
FILE *in = fopen(input, "r");
+
int s_length = get_array_length(in);
- struct file_size *fs = (struct file_size *)malloc((s_length + 1) * sizeof(struct file_size));
+ struct file_size *fs = (struct file_size *)
+ malloc(s_length * 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));
+ 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));
+ fs = (struct file_size *)
+ realloc(fs, s_length * sizeof(struct file_size));
}
free(fs);