View Full Version : C# Byte array to String

09-02-2011, 06:31 PM
So yeah i managed to write a application which attaches to a process by window name and then i made a code which retrieves the value of a certain address (ptr) in memory. Its just when i convert the output bytes i get weird symbols. For example if the value the address holds is 250 it returns something different, not letters and not numbers, just some weird looking symbols.

The adr i declare like this:

uint adrChrHp = 0x0000000;
Do i have to add the offset to this aswell, if so how can i do that.

09-02-2011, 09:28 PM
You want to convert a byte array into something you can print out? You can do that using the ASCIIEncoding (http://msdn.microsoft.com/en-us/library/system.text.asciiencoding.aspx) class. Look at the GetChars and GetString functions. To do the reverse look at GetBytes.

09-03-2011, 12:33 AM
Converting byte array to string (http://stackoverflow.com/questions/1422314/converting-byte-array-to-string-and-back-again-in-c) and back again in C#