Merging data from two output files

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simone
    New Member
    • Aug 2006
    • 1

    Merging data from two output files

    I have an output file, say OUT.TXT generated using VB6 code.

    I also have an input data file say IN.TXT stored on my computer and I need to copy data from some of the columns tn the file IN to the corresponding columns in the file OUT. At present the columns in OUT that I need to put the data in have 0's or nulls.

    Pleae help.
  • BSOB
    New Member
    • Jul 2006
    • 77

    #2
    um.. hint:
    look at the different modes that you can open a file for exiting in. its been a long time since i worked with txt files but there was a mode where line by line editing was posible.
    if you dont find it that way, you can always load (read) both files into two seperate string arrays. replace the out strings with the in strings of the index that you want to "move" and then write the out array back to the out file.

    and for the record, i say its a hint because that makes it sound like i know more then im giving you and therefore makes me look smart.

    Comment

    • the peasant
      New Member
      • Aug 2006
      • 4

      #3
      Originally posted by simone
      I have an output file, say OUT.TXT generated using VB6 code.

      I also have an input data file say IN.TXT stored on my computer and I need to copy data from some of the columns tn the file IN to the corresponding columns in the file OUT. At present the columns in OUT that I need to put the data in have 0's or nulls.

      Pleae help.
      You need to read the file IN.TXT in line by line.

      For instance,

      Dim n as integer, textline(1000) as string 'for a file up to 1000 lines long
      n=1
      Open "IN.TXT" for input as #1
      while not eof(1)
      line input #1, textline(n) 'get whole line
      n=n+1
      wend
      close #1

      You now have the whole of your IN.TXT in the textline array and you can pick out the columns you require from there.

      Hope this helps.
      The Peasant

      Comment

      Working...