From 583808ce5d9a482765ef7d09502e6fb0229071a7 Mon Sep 17 00:00:00 2001 From: thibault62 Date: Tue, 13 Dec 2016 10:12:50 +0100 Subject: [PATCH] Create Tables 68*20 --- Tables 68*20 | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Tables 68*20 diff --git a/Tables 68*20 b/Tables 68*20 new file mode 100644 index 0000000..2da4d21 --- /dev/null +++ b/Tables 68*20 @@ -0,0 +1,43 @@ +#include +#include + +void afficherTableau(int* tableau1); +int main(void) +{ + int* tableau1 = malloc(sizeof(int)*68*20); + FILE* fichier = fopen("image1(2)","r+"); + char c = 0; +int i=0; +int cpt = 0; + while ( cpt < 2) { + c= fgetc(fichier); + if (c == '\n') + cpt++; + } + + + do { + c= fgetc(fichier); + if(c == '0' || c == '1') { + tableau1[i++] = c; + } + }while(c != EOF); + + afficherTableau(tableau1); + free(tableau1); + return EXIT_SUCCESS; /* Equivalent à return 0 sous Windows, permet un code portable */ +} + +void afficherTableau(int* tableau1) +{ + int i = 0; + int j = 0; + + for (i = 0; i < 20; i++) { + for(j = 0; j < 68; j++) { + printf("Tableau1[%d][%d] = %c\n", i, j, tableau1[i*68+j]); + + + } + } +}