Ejemplo n.º 1
0
int main (int argc, char** argv)
{
    printf("Starting mergesort\n");
    m_mergesort(NULL);

    return 0;
}
Ejemplo n.º 2
0
main(int argc, char **argv) {
    int fd1, fd2, k;
    off_t size;
    char *endptr = NULL;

    if (argc < 5) {
        printf("This test requires a file as the first argument, n_elems as the second, an aux file as the third and k as the fourth\n");
        exit(1);
    }

    size = atoll(argv[2]);
    
    fd1 = open(argv[1], O_RDONLY);
    print_file_integers(fd1);

    close(fd1);

    printf("Sorting...\n");
    fd1 = open(argv[1], O_RDWR);
    fd2 = open(argv[3], O_RDWR);

    k = atoi(argv[4]);

    m_mergesort(fd1, fd2, k, size);

    lseek(fd1, 0, SEEK_SET);
    print_file_integers(fd1);
    close(fd1);
    close(fd2);
}