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. Open - change and save AScii in visual Basic problem

Open - change and save AScii in visual Basic problem

Scheduled Pinned Locked Moved Visual Basic
tutorialhelpquestion
2 Posts 1 Posters 1 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Hello I've got al little problem converting parts of a record in an ASCii file. In different ascii files with different number of records must position 5 and 6 be convertet to 0 and then it must be saved again. for example : F1C58475 0- B2C58757 0- E9D48747 1- R0A01477 8- Does anyone has an idia how to do this? Tanx Greetings Nahoj

    L 1 Reply Last reply
    0
    • L Lost User

      Hello I've got al little problem converting parts of a record in an ASCii file. In different ascii files with different number of records must position 5 and 6 be convertet to 0 and then it must be saved again. for example : F1C58475 0- B2C58757 0- E9D48747 1- R0A01477 8- Does anyone has an idia how to do this? Tanx Greetings Nahoj

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      in.txt F1C58475 0- B2C58757 0- E9D48747 1- R0A01477 8-

      'VB script example
      const infile = "C:\...\in.txt"
      const outfile = "C:\...\out.txt"

      set fso = CreateObject("Scripting.FileSystemObject")
      set tsin = fso.OpenTextFile(infile)
      set tsout = fso.CreateTextFile(outfile)
      do while(not tsin.AtEndOfStream)
      str = tsin.ReadLine
      str = mid(str,1,4) & "00" & mid(str,7)
      tsout.WriteLine str
      loop
      tsout.Close
      tsin.Close

      out.txt F1C50075 0- B2C50057 0- E9D40047 1- R0A00077 8-

      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