Home > DeveloperSection > Forums > Conversion from 32 bit integer to 4 chars
Ankit Singh

Total Post:341

Points:2389
Posted on    November-14-2013 3:08 AM

 C# C# 
Ratings:


 1 Reply(s)
 682  View(s)
Rate this:
What is the best way to divide a 32 bit integer into four (unsigned) chars in C#?


ezra heywood
ezra heywood

Total Post:145

Points:1019
Posted on    November-14-2013 4:57 AM

Hi ankit,

int value = 0x48454C4F;

Console.WriteLine(Encoding.ASCII.GetString(

  BitConverter.GetBytes(value).Reverse().ToArray()

));

Don't want to miss updates? Please click the below button!

Follow MindStick