Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2009
    Posts
    78
    Thanks
    1
    Thanked 2 Times in 2 Posts

    C# Byte array to String

    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.

    Question:
    The adr i declare like this:
    Code:
     uint adrChrHp = 0x0000000;
    Do i have to add the offset to this aswell, if so how can i do that.

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    You want to convert a byte array into something you can print out? You can do that using the ASCIIEncoding class. Look at the GetChars and GetString functions. To do the reverse look at GetBytes.
    OracleGuy

  • #3
    New Coder
    Join Date
    Aug 2011
    Posts
    50
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Converting byte array to string and back again in C#
    Don't forget to mark solution providing post as "Answered".
    It helps others to find correct solutions!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •