CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2006
    Posts
    2

    Converting Binary Data to ASCII

    Hello I am working on a C# application that is to read a file with binary data (in format of 00 A0 B2 E0 23 and so on and so forth, the file is multiple lines as well). I need the data to be read in and then from each group I need that value converted to its ASCII value (like 00 should produce 0 and 65 should produce A). Once I have a string of the corresponding ASCII characters I will be in good shape. I have been running around on this and am having no luck. Tried using Binaryreader and that takes each digit, don't want that.

    Thanks for any help!!

  2. #2
    Join Date
    Sep 1999
    Location
    Madurai , TamilNadu , INDIA
    Posts
    1,024

    Re: Converting Binary Data to ASCII

    Did you try any one of the encoding classes?

    Try

    System.Text.Encoding.ASCII.GetString(bytes); method..

    If that doesn't work, it should most prob. be the encoding problem. Try different encoding classes (Encoding)

    Start with "1252 Windows-1252 Western European (Windows) "

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured