Newer
Older
void readToTab(long* tab, char* file){
int fd = open(file, O_RDONLY);
int i =0;
long tmp[2];
int nb = read(fd, tmp, sizeof(long)*2);
while(nb == 2){
tab[i] = tmp[0];
nb = read(fd,tmp,sizeof(long)*2);
i++;
}
}
if(argc!=3){
printf("Usage: ./tri <option> <input.txt>\n");
exit(1);
}
long* tab = malloc(sizeof(long)*100);
readToTab(tab, argv[2]);
for(int i = 0; i<100; i++){
printf("%ld - ", tab[i]);
}
if((strcmp(argv[1], "--insertion") == 0)){
}
else if((strcmp(argv[1], "--fusion")== 0)){
}
else if((strcmp(argv[1], "--rapide")== 0)){
}
else{
printf("Usage: ./tri <option> <input.txt>\n");
}
free(tab);