#define TAILLE_MAX_PROGRAMME 1000
#define TAILLE_MAX_MEMOIRE 30000
#include <stdio.h>
//void ibf(unsigned char, unsigned long);
char selection(unsigned char);
int main(int argc, char *argv[]){
FILE* file = NULL;
unsigned char cell[30000];
unsigned char newfile[TAILLE_MAX_PROGRAMME];
unsigned char character;
unsigned long count =0;
file=fopen(argv[1], "r");
if (file != NULL){
printf("repere 1");
do{
character = fgetc(file);
printf("repere 2");
if (selection(character)!=0){
/*
Ne prendre que les 8 caractères utilisé en BrainFuck
et les stocker dans une liste pour enlever les carracteres
qui pourraient engendré un plantage
filtrage manuel
*/
newfile[count] = character;
count++;
}
} while (character != EOF);
//*
long i;
for(i=0;i<TAILLE_MAX_PROGRAMME;i++){
printf("%cu\n", newfile[i]);
}
//*/
//ibf(newfile, TAILLE_MAX_PROGRAMME);
/* brainfuck interpréteur */
getchar();
fclose(file);
}
else{
printf("Pas de fichier d'entré \nNO FILE INPUT\nPlease see \"ibrainfuck --help for more info\"");
return 2;
}
return(0);
}
/*---------------------------------------------------------------*/
char selection(unsigned char character){
if (character == 43/* + */ || character == 45/* - */ || character == 62/* > */ || character == 60/* < */ || character == 91/* [ */ || character == 93/* ] */ || character == 46/* . */ || character == 44/* , */){
return character;
}
else{
return 0;
}
}
la compilation se passe bien, c'est au niveau de l'execution
il devient while(1) au niveau de la boucle do-while (affichage de mon repere 2 en continu)
je suis sous linux en je c'est pas si le EOF (End Of File) est compatible
Faire une citation pour avoir les tabulation
_________________
Màj
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GM d- s+: a--- C++ UL++>B* P+ L+++ E+>+++ W+>+++ N o K? w---
O? M- V PS+++ PE-- Y-- PGP+>++++ t 5? X R+ tv- b++ DI+ D
G++ e+ h!
------END GEEK CODE BLOCK------
ASUS Laptop
Intel Pentium Dual-Core Inside Duo T2330
17" WXGA+
RAM 2 Go
Intel GMA X3100 Gix
GNU/Linux Debian
Architecture 64 bits
Navigateur: Iceweasel, Kazehakaze