CONVERSION FROM 32 BIT INTEGER TO 4 CHARS

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
C# 
C#
 985  View(s)
Ratings:
Rate this:
What is the best way to divide a 32 bit integer into four (unsigned) chars in C#?
  1. ezra heywood

    Post:145

    Points:1019
    Re: Conversion from 32 bit integer to 4 chars

    Hi ankit,

    int value = 0x48454C4F;

    Console.WriteLine(Encoding.ASCII.GetString(

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

    ));

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!