Форум АНТИЧАТ

Форум АНТИЧАТ (https://forum.antichat.xyz/index.php)
-   С/С++, C#, Delphi, .NET, Asm (https://forum.antichat.xyz/forumdisplay.php?f=24)
-   -   блин помогите пожалусто (https://forum.antichat.xyz/showthread.php?t=101937)

nepomniu 18.01.2009 20:14

блин помогите пожалусто
 
как на языке с++ выглядет код конвертирования с decimal в hex ????

LEE_ROY 18.01.2009 20:33

int main() {
char outStr[256];
int inDec = 65535;
sprintf(outStr,"%x",inDec);
printf("%d in hex is %s\n",inDec,outStr);
}
(c) Google

nepomniu 18.01.2009 20:39

спс

St0nX 18.01.2009 21:44

Код:

long dec_hex(int n)
{
    static char number[255];
    sprintf(number, "%lx", n);
        char null = '\x0';
        char * adr_null = &null;
        ULONG a = strtoul(number, &adr_null, 16);
    return  a;
}

Возвращает 0х'hex' а не "hex".


Время: 18:59