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>
|
||||
#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.
1
gestion_des_fichiers/test.txt
Normal file
1
gestion_des_fichiers/test.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
NULL
|
||||
|
|
@ -1 +1 @@
|
|||
ABCDE
|
||||
NNN
|
||||
Reference in a new issue