Skip to content
Snippets Groups Projects
Commit a572be2f authored by chafiol's avatar chafiol
Browse files

main

parent c3215923
No related merge requests found
No preview for this file type
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
void triInsertion(long* A, size_t n);
void sousTriFusion(long * A, size_t p, size_t r);
......
No preview for this file type
#include "algos.h"
#include <stdio.h>
#include <string.h>
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++;
}
}
int main(int argc, char **argv){
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);
return 0;
}
\ No newline at end of file
3 4 5 6 1 2 9
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment