genre ca :
int get_val_from_digit(char c, char *hex_buff) { if ((c < '0' || c > '9') && (c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) { fprintf(stderr, "invalid hexadecimal value : %s\n", hex_buff); exit(0); } if (c >= '0' && c <= '9') return (c - '0'); else { if (c >= 'a' && c <= 'z') c -= 32; return (c - 'A' + 10); } }
int hex_to_asc(char *hex_buff) { int c; int i, k; int val;
val = 0; k = (int)strlen(hex_buff) - 1; for (i = 0; hex_buff[i]; i++) { c = get_val_from_digit(hex_buff[i], hex_buff); val += (c * (1 << (4 * (k - i)))); } return (val); }
:)
------------------------------- Réponse au message : -------------------------------
> bin vers base x, tu as itoa() et ultoa. > Le reste on l'ecrit. > BruNews, ciao... > > > ------------------------------- > Réponse au message : > ------------------------------- > > > Bonjour !!! > > > > Je voulais savoir s'il existait une fonction contenue dans une librairie du C++ pour convertir des nombres d'une base à une autre, comme du décimal en hexadécimal. > > > > Merci > > > > > > M@théus >
|