1. ## concatenate hex numbers

Hi guys,

I am new to C++ and had a question.

I have a table of 4-digit hex numbers in each row and I want to go through the table, choose row1 and row2 and concatenate the 4-digit hex numbers into an 8-digit hex number.

For example, I have 0x123A in row1 and 0x45BC in row2 of the table. I want to to get 0x123A45BC and compare it to another 8-digit user input hex number.

How would I go about doing this? srtcat and strcmp?

By the way, the hex numbers in the table are mapped to locations D000-D3FF in a hard disk. Meaning that row1 (4 digit hex) is in location D000 and row2 is in D001 and so on.
So maybe I could concate the memory locations and then compare them to the user input?

I would appreciate any help,

Thanks,
Ryan

2. Originally Posted by ryanE
For example, I have 0x123A in row1 and 0x45BC in row2 of the table. I want to to get 0x123A45BC and compare it to another 8-digit user input hex number.

How would I go about doing this? srtcat and strcmp?
It depends on how they are stored. Are they strings? Or is this table something like an actual const array of ints?

The table is actually stored with hex constants all throughout.
e.g. the first row is "123A" (memory location D000), second row is 45BC (mem loc D001) and so on.

4. Well if I did this in decimal math, then:

a = 1234, b = 5678;
a = a * 10^4
a = a + b

It's the same thing in a different base.

5. Originally Posted by whiteflags
Well if I did this in decimal math, then:

a = 1234, b = 5678;
a = a * 10^4
a = a + b

It's the same thing in a different base.