How to get hex zeros or hex FF into a string ?

T

Tony Girgenti

How do you get binary zeros or hex FF into a string ?

I tried Hex(0) and Hex(FF), but they just yield ascii "0" and ascii "FF".

Also, when you WATCH a variable, how do you show it contents in hex ?

Thanks,
Tony
 
D

Dirk Goldgar

Tony Girgenti said:
How do you get binary zeros or hex FF into a string ?

I tried Hex(0) and Hex(FF), but they just yield ascii "0" and ascii
"FF".

Chr(0) and Chr(255) ought to do it.
 
T

TC

If he wanted string values "0" and "255", he would just use:

"0"
"255"

not:

hex$(0)
hex$(255) !

I think he wants a 1-byte item containing the value &h0 or &hFF. When he
says "string", it sounds like he wants that 1-byte value to be followed by a
1-byte &h0 terminator.

But, as all he can say is "it doesn't work", we will probably never know ...

TC
 
S

SteveS

According to the HELP file, you have to use decimal
numbers in the Hex function. So Hex(0) results in a string
0 ("0") and Hex(255) results in a string FF ("FF").

You can also use &H0 or &HFF; these result in numbers
which can then be converted to strings like you wanted.

HTH

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top