Hex addition with VC++ in WinXP
-
Hello everybody, I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII. Here is my problem: hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1 which is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal. I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with C++? Your help is very much appreciated, thank you.:)
-
Hello everybody, I am a newbie to C++ programming and I need to do some hex addition with VC++ and then output the result as ASCII. Here is my problem: hex1(5A 30 35 30 30) which is equal to decimal(387355848752), I want to add hex(100) to hex1 which is hex2(5A 30 35 31 30) equal to decimal(387355849008). This is exactly equal to adding 256 to the first decimal. I know unsigned int data type can only support 4294967295 which is still not enough for my case, and I would like to know how to convert these hex to ASCII with C++? Your help is very much appreciated, thank you.:)
If this is a C++ question and not a C++/CLI question then you are in the wrong forum.
long long h1 = 0x5A30353030LL; long long h2 = 0x100LL; _tprintf_s(_T("%I64X\n"), h1 + h2);
-- modified at 13:03 Saturday 2nd December, 2006 -
If this is a C++ question and not a C++/CLI question then you are in the wrong forum.
long long h1 = 0x5A30353030LL; long long h2 = 0x100LL; _tprintf_s(_T("%I64X\n"), h1 + h2);
-- modified at 13:03 Saturday 2nd December, 2006Thank you very much! It works fine and I was in such hurry and I overlooked (Managed), and I should have posted on the VC++/MFC board? Sorry for my mistake.:) Besides, how can I convert the resulting hex to ASCII string? Is there a function _tprintf_s(_T("%s\n"), h1+h2); ? I tried but it does not work.:confused: -- modified at 13:35 Saturday 2nd December, 2006