What is the variable/data type for hexadecimal value?

Hi,

if I want to stock an hexadecimal value (for example: $00000040) into a variable, what kind of variable should I use?

like

begin
var
  containshexa: ????;

I have to stock it into the right data type because after, I will use it into a message box, such as
MessageBox(0, PChar('Title'), pchar('Message'), containshexa);

500 points for this one, thx a lot!
Marc582Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rfwoolfCommented:
You can just store it as a string and then use something like
StrToInt('$'+HexString)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rfwoolfCommented:
and then to show it in hex you say

procedure TForm1.Button1Click(Sender: TObject);
var
  s: String;
  i: Integer;
begin
  s := '$00000060';
  i := StrToInt(s);
  ShowMessage(IntToStr(i)); //it's an integer, so it's displayed in decimal
notation.  $60h=96d
  ShowMessage('$' + IntToHex(i, 8));//show it in hex
end;
0
Marc582Author Commented:
ok so it means there is not really a variable/data type dedicated to stock hexadecimal value, I really need to use conversion? weird!
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

diniludCommented:
containshexa: Cardinal
0
MerijnBSr. Software EngineerCommented:
no, there is no special type. It's exactly the same as a decimal number, it's just displayed differently.
Just use an integer, shortint, cardinal, whatever what you would normally use.
0
ziolkoCommented:
in addition to MarijnB's comment...

Marc582 your sample $00000040 indicates that it is 4byte long value so to store it you need type which can store at least 4 bytes, but equally important is range of values you want to store

for example if you use Cardinal you will not be able to store negative values
but if you choose Integer you will be able to store neg. values but accepted range is deifferent (-2147483648..2147483647 for Integere against 0..4294967295 for Cardinal)

it is also possible that you don't need all 4 bytes and in $00000040 are some leading zeros.

ziolko.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.