#include #include #include #include"mars_types.h" /* importe les types utilisés dans le programme */ #include"options.h" /* Inclus les options du programme */ int ouvrir_fichier(char* path){ FILE* fluxouverture; char instru[4]; char arg1[4], arg2[4]; int c=0; int i; int ligne=0; char buffer[4]; char previnstru[4]; // contient l'instruction ayant été "mal interprétée" à cause d'une instruction mauvaise int errinstru; // flag qui aide le prog à savoir si l'instruction précédente était mauvaise buffer[0]='\0'; fluxouverture=fopen(path, "r"); if (fluxouverture == NULL){ perror("fopen"); return EXIT_FAILURE; } if (fluxouverture){ while (!feof(fluxouverture)){ instru[0]='\0'; arg1[0]='\0'; arg2[0]='\0'; printf("\n"); /*fread(&instru,sizeof(char),1,fluxouverture); fread(&arg1,sizeof(char),3,fluxouverture); fread(&arg2,sizeof(char),3,fluxouverture); printf("%s %s %s\n", instru, arg1, arg2);*/ fscanf(fluxouverture, "%s %s %s", instru, arg1, arg2); for (i=0; i