Yûki - Update Bit a Bit
This commit is contained in:
parent
9d60a36ab8
commit
0a5b3ef12d
6 changed files with 14 additions and 11 deletions
|
|
@ -2,20 +2,20 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#define BIN_MAX 8
|
#define BIN_MAX 8
|
||||||
|
|
||||||
void binaire(unsigned int n, char s[]);
|
void int_to_bin(unsigned int n, char s[]);
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv){
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char buffer;
|
char buffer;
|
||||||
int cursor,c,i;
|
int cursor,c,i;
|
||||||
file=fopen("text.txt","rb");
|
file=fopen("test.txt","rb");
|
||||||
char text_b[5][BIN_MAX+1];
|
char text_b[5][BIN_MAX+1];
|
||||||
i=0;
|
i=0;
|
||||||
// EOF : End Of File
|
// EOF : End Of File
|
||||||
while((c=fgetc(file))!=EOF){
|
while((c=fgetc(file))!=EOF){
|
||||||
char sb[BIN_MAX+1];
|
char sb[BIN_MAX+1];
|
||||||
binaire(c,sb);
|
int_to_bin(c,sb);
|
||||||
printf("%s\n",sb);
|
printf("%d : %s\n",c,sb);
|
||||||
}
|
}
|
||||||
for(i=0;i<5;i++){
|
for(i=0;i<5;i++){
|
||||||
for(int j=0;j<BIN_MAX;j++){
|
for(int j=0;j<BIN_MAX;j++){
|
||||||
|
|
@ -26,7 +26,7 @@ int main(int argc, char **argv){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void binaire(unsigned int n, char s[]){
|
void int_to_bin(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)
|
Décomposition binaire d'un entier (<BIN_MAX) et place celle-ci dans une chaîne de caractères passée en argument (s)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
1
gestion_des_fichiers/test.txt
Normal file
1
gestion_des_fichiers/test.txt
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
NULL
|
||||||
|
|
@ -1 +1 @@
|
||||||
ABCDE
|
NNN
|
||||||
|
|
@ -13,7 +13,7 @@ int main(int argc, char **argv){
|
||||||
const char *mode= "rb";
|
const char *mode= "rb";
|
||||||
// Vérification de l'existance du second argument (Nom du fichier à compresser)
|
// Vérification de l'existance du second argument (Nom du fichier à compresser)
|
||||||
printf("Argc : %d\n",argc);
|
printf("Argc : %d\n",argc);
|
||||||
if(argc != 2){
|
if(argc == 2){
|
||||||
printf("\nErreur : Veuillez mettre en argument un nom de fichier à compresser (Ex: %s text.txt)\n",argv[0]);
|
printf("\nErreur : Veuillez mettre en argument un nom de fichier à compresser (Ex: %s text.txt)\n",argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -23,10 +23,12 @@ int main(int argc, char **argv){
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
printf("test\n");
|
printf("test\n");
|
||||||
int *nb_char;
|
int nb_char;
|
||||||
*nb_char=0;
|
nb_char=0;
|
||||||
|
int *p;
|
||||||
|
p=&nb_char;
|
||||||
Freq freq;
|
Freq freq;
|
||||||
freq = freq_apparition(file, nb_char);
|
freq = freq_apparition(file, p);
|
||||||
printf("hey");
|
printf("hey");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue