Click here to Skip to main content
15,923,389 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SetFont Pin
ThatsAlok4-Dec-06 21:44
ThatsAlok4-Dec-06 21:44 
Questionproblem with propertyPage Pin
zizzzz3-Dec-06 1:01
zizzzz3-Dec-06 1:01 
QuestionHow to change int to COleDateTime? Pin
hanlei00000000092-Dec-06 19:51
hanlei00000000092-Dec-06 19:51 
AnswerRe: How to change int to COleDateTime? Pin
Joe Woodbury2-Dec-06 23:11
professionalJoe Woodbury2-Dec-06 23:11 
Generalthanks Pin
hanlei00000000095-Dec-06 17:25
hanlei00000000095-Dec-06 17:25 
AnswerRe: How to change int to COleDateTime? Pin
ThatsAlok3-Dec-06 19:24
ThatsAlok3-Dec-06 19:24 
Generalthanks Pin
hanlei00000000095-Dec-06 17:24
hanlei00000000095-Dec-06 17:24 
QuestionHex addition and Hex-to-ASCII string conversion with VC++ Pin
pkyiu2-Dec-06 17:08
pkyiu2-Dec-06 17:08 
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, result 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 VC++? (Help received! Thx)

Besides, I need to convert the output to ASCII string format, which is "Z0500" and "Z0510" respectively, how can I do that?

Your help is very much appreciated, thank you!Smile | :)

Here is the code with help from forum member, but my second question is not yet solve:

#include <iostream>
#include <atlstr.h>
#include <string.h>
#include <sstream>
#include <conio.h>
#include <ctype.h>



int main()
{
long long h;
long long h1 = 0x5A30353030LL;
long long h2 = 0x5A303F3F30LL;
long long h3 = 0x100LL;
CString Str;
unsigned char Write_Buff[1];

for (h=h1; h<=h2; h+=h3)
{
_tprintf_s(_T("%I64X\n"), h);
Write_Buff[0] = h;
Str.Format("0x0%x",Write_Buff[0]);
Sleep(10);
}

_getch();

}
QuestionRe: Hex addition and Hex-to-ASCII string conversion with VC++ Pin
George L. Jackson3-Dec-06 3:54
George L. Jackson3-Dec-06 3:54 
AnswerRe: Hex addition and Hex-to-ASCII string conversion with VC++ Pin
pkyiu7-Dec-06 16:36
pkyiu7-Dec-06 16:36 
GeneralRe: Hex addition and Hex-to-ASCII string conversion with VC++ Pin
George L. Jackson7-Dec-06 23:57
George L. Jackson7-Dec-06 23:57 
QuestionProblem with CString length [modified] Pin
Milos Djokovic2-Dec-06 14:23
Milos Djokovic2-Dec-06 14:23 
AnswerRe: Problem with CString length Pin
David Crow2-Dec-06 15:23
David Crow2-Dec-06 15:23 
GeneralRe: Problem with CString length Pin
Milos Djokovic2-Dec-06 16:20
Milos Djokovic2-Dec-06 16:20 
GeneralRe: Problem with CString length Pin
Joe Woodbury2-Dec-06 18:39
professionalJoe Woodbury2-Dec-06 18:39 
GeneralRe: Problem with CString length Pin
Joe Woodbury2-Dec-06 18:46
professionalJoe Woodbury2-Dec-06 18:46 
GeneralRe: Problem with CString length Pin
Milos Djokovic2-Dec-06 20:58
Milos Djokovic2-Dec-06 20:58 
GeneralRe: Problem with CString length Pin
ThatsAlok3-Dec-06 20:05
ThatsAlok3-Dec-06 20:05 
GeneralRe: Problem with CString length Pin
David Crow4-Dec-06 3:28
David Crow4-Dec-06 3:28 
GeneralRe: Problem with CString length Pin
ThatsAlok4-Dec-06 18:27
ThatsAlok4-Dec-06 18:27 
QuestionRe: Problem with CString length Pin
David Crow5-Dec-06 2:33
David Crow5-Dec-06 2:33 
Questionstd::sort in Debug builds Pin
Bartosz Bien2-Dec-06 11:43
Bartosz Bien2-Dec-06 11:43 
QuestionHow to get the file handle of an ifstream Pin
Vancouver2-Dec-06 9:55
Vancouver2-Dec-06 9:55 
AnswerRe: How to get the file handle of an ifstream Pin
CPallini2-Dec-06 10:27
mveCPallini2-Dec-06 10:27 
GeneralRe: How to get the file handle of an ifstream Pin
Vancouver2-Dec-06 15:01
Vancouver2-Dec-06 15:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.