how to convert high decimal values into binary code and show them with sprintf ?? | Cypress Semiconductor
how to convert high decimal values into binary code and show them with sprintf ??
I need to convert some hugh values (~120000) into binary code. Unfortunately this only works if my value is 1023 or less.
Does anyone have an idea? Is something wrong with the conversion or just with the sprintf? I tried to change the argument %... of sprintf but no success.
long num, decimal_num, remaind, base =1, binary =0;
decimal_num = num;
remaind = num %2;
binary = binary + remaind * base;
num = num/2;
sprintf(TransmitBuffer, "real_comb_binary: %ld \n", binary);
Thanks in advance,