Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Printing Array of Bytes to File

Printing Array of Bytes to File

Scheduled Pinned Locked Moved Visual Basic
questiondata-structuresdebugging
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChemmieBro
    wrote on last edited by
    #1

    I currently have an array of bytes and I want to print it to a file. When I open the filename and do the following statement: Print #FileName, ArrayOfBytes it prints a bunch of question marks and other characters that aren't the correct characters. When I run the debugger, the values within the individual elements of the array are all the correct decimal ascii values. ArrayOfBytes(1) = 50 It should be "P", which is what I want printed. ArrayOfBytes(2) = 88 It should be "X", which is what I want printed. How do I print this to a file but get the correct character values? Thank you.

    B 1 Reply Last reply
    0
    • C ChemmieBro

      I currently have an array of bytes and I want to print it to a file. When I open the filename and do the following statement: Print #FileName, ArrayOfBytes it prints a bunch of question marks and other characters that aren't the correct characters. When I run the debugger, the values within the individual elements of the array are all the correct decimal ascii values. ArrayOfBytes(1) = 50 It should be "P", which is what I want printed. ArrayOfBytes(2) = 88 It should be "X", which is what I want printed. How do I print this to a file but get the correct character values? Thank you.

      B Offline
      B Offline
      BammBamm
      wrote on last edited by
      #2

      You need to convert the decimal values back to ascii characters. Here is a code snippet =Encoding.ASCII.GetString(ArrayOfBytes,0,ArrayOfBytes.Length); this returns a ascii encoded string

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups