|
-
December 17th, 2002, 10:27 AM
#1
hex numbers (unicode) to String
Hi,
1. I want to convert some Hex numbers which contain unicode vallues into a string, Say, I have
0x0 0x0 0x4 0x2 which means "b" (I think)
I want to get a string containing "b".
I tried this:
-------------------------------------------
byte[] b = {0x0, 0x0 ,0x4 ,0x2};
System.Text.Encoding u = new System.Text.UnicodeEncoding();
string h = u.GetString(b);
--------------------------------------------
but the returned string equals "".
2. How can I convert an int or such to a hex-String ? Like I have int i = 0; and I want to get a string containing "0x0".
Thanks for you time !
regards, Lobo
-
December 17th, 2002, 10:34 AM
#2
Multi byte numbers are stored LittleEndian on PCs!
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions 
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 17th, 2002, 10:59 AM
#3
got it.
Thanks, the problem was the bytearray (not 0x4, 0x2 but 0x42).
Thanks anyway!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|