URL: https://linuxfr.org/forums/programmation-c--2/posts/convertion-valeur-hexadecimal-en-decimal Title: convertion valeur hexadecimal en decimal Authors: demo2000 Date: 2005年10月05日T18:19:42+02:00 Tags: Score: 0 bonjour, voilà mon fichier binaire en hexadecimal : A1 A2 A3 A4 BB DD AA FF je voudrais lire les 4 premier octet (ecrit en hexadecimal), en decimal ! la valeur du 4 octet en hexa est lu à partir de la fin ! c.à.d : hex(A4 A3 A2 A1) = ? (decimal) voilà ou je suis : #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char ** argv) { FILE *infile; FILE *outfile; int i=0; if ((infile = fopen(argv[1], "rb")) == NULL) { fprintf(stderr, "Pb ouverture infile !\n"); return(EXIT_FAILURE); } if(!fread(&i,1,4, infile)) { fprintf(stderr,"fread header Failure !\n"); return(EXIT_FAILURE); } printf("%d\n",i); return(EXIT_SUCCESS); } la valeur afficher ne convient pas ! Merci