Add file organization

This commit is contained in:
NyxiumYuuki 2019-12-07 20:24:56 +01:00
parent ccddc6a1af
commit 1795f0287b
No known key found for this signature in database
GPG key ID: 03E8F3CF3183323A
9 changed files with 140 additions and 26 deletions

View file

@ -7,14 +7,21 @@ void binaire(unsigned int n, char s[]);
int main(int argc, char **argv){
FILE *file;
char buffer;
int cursor,c;
int cursor,c,i;
file=fopen("text.txt","rb");
char text_b[5][BIN_MAX+1];
i=0;
// EOF : End Of File
while((c=fgetc(file))!=EOF){
char sb[BIN_MAX+1];
binaire(32,sb);
binaire(c,sb);
printf("%s\n",sb);
}
for(i=0;i<5;i++){
for(int j=0;j<BIN_MAX;j++){
printf("%c",text_b[i][j]);
}
}
fclose(file);
return 0;
}
@ -22,7 +29,6 @@ int main(int argc, char **argv){
void binaire(unsigned int n, char s[]){
/*
Décomposition binaire d'un entier (<BIN_MAX) et place celle-ci dans une chaîne de caractères passée en argument (s)
*/
assert(n>=BIN_MAX);
s[BIN_MAX]= '\0';
@ -37,4 +43,8 @@ void binaire(unsigned int n, char s[]){
i++;
}
}
}
int k;
for(k=BIN_MAX-i-1;k>=0;k--){
s[k]= '0';
}
}

View file

@ -0,0 +1,4 @@
/*
Fonctions liés à la gestion de fichiers
*/

View file

@ -0,0 +1,3 @@
/*
Prototypes de gestion_fichiers.c + variables define + structure(s)
*/