Yûki - Update Bit a Bit

This commit is contained in:
NyxiumYuuki 2019-12-09 18:24:19 +01:00
parent 9d60a36ab8
commit 0a5b3ef12d
No known key found for this signature in database
GPG key ID: 03E8F3CF3183323A
6 changed files with 14 additions and 11 deletions

View file

@ -2,20 +2,20 @@
#include <assert.h>
#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){
FILE *file;
char buffer;
int cursor,c,i;
file=fopen("text.txt","rb");
file=fopen("test.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(c,sb);
printf("%s\n",sb);
int_to_bin(c,sb);
printf("%d : %s\n",c,sb);
}
for(i=0;i<5;i++){
for(int j=0;j<BIN_MAX;j++){
@ -26,7 +26,7 @@ int main(int argc, char **argv){
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)
*/
@ -47,4 +47,4 @@ void binaire(unsigned int n, char s[]){
for(k=BIN_MAX-i-1;k>=0;k--){
s[k]= '0';
}
}
}

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1 @@
NULL

View file

@ -1 +1 @@
ABCDE
NNN

View file

@ -13,7 +13,7 @@ int main(int argc, char **argv){
const char *mode= "rb";
// Vérification de l'existance du second argument (Nom du fichier à compresser)
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]);
return -1;
}
@ -23,10 +23,12 @@ int main(int argc, char **argv){
return -2;
}
printf("test\n");
int *nb_char;
*nb_char=0;
int nb_char;
nb_char=0;
int *p;
p=&nb_char;
Freq freq;
freq = freq_apparition(file, nb_char);
freq = freq_apparition(file, p);
printf("hey");
return 0;
}