Problem converting byte to hex number

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rhea
    New Member
    • Feb 2007
    • 1

    #1

    Problem converting byte to hex number

    Hi,

    The below code doen't seem to work :-(( The hex number I am trying to fetch is incorrect. Please can any one throw somme light

    Code:
    NetworkStream ns= new NetworkStream(soc);
    StringBuilder strBuff = new StringBuilder();
    Int64 ch;
    char rdCh;
    
    do
    {
    ch = ns.ReadByte();                    
    rdCh = Convert.ToChar(ch);
    strBuff.Append(rdCh);
    } while (rdCh != '\n');
    
    int size = Int32.Parse(strBuff.ToString(), System.Globalization.NumberStyles.HexNumber);
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    What is soc?

    Comment

    Working...