losing data when writing into a txt file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • itrdbg
    New Member
    • Jul 2008
    • 3

    #1

    losing data when writing into a txt file

    I am programming to generate keys using different schemes for which i call different funtions and append data into a text file. At the end I am supposed to generat around 24320 bytes of data but end up with only 20000 which is printed in the text file.
    Now I am only generating a portion of it that is 2048 bytes of which only 1800 is generated .
    I am pasting the code which actually reads a value from one file and transforms it with an value from another file and appends it into the third file.

    Private Sub transform(file, fileN)
    'Dim abArray(30210)
    Dim abArray()
    Dim t As Long
    Dim x
    count = 0

    fileNK = file & ".dat"
    Open fileNK For Append As #13


    fName = "data\" & "TT1" & ".TXT"

    Open fileN For Input As #3

    On Error GoTo ErrorHandler

    Do While Not EOF(3)

    Line Input #3, x

    Counter = 0

    Open fName For Input As #14

    Do While Not EOF(14) ' Outer loop.

    Counter = Counter + 1

    Line Input #14, y

    If x = y Then

    ReDim Preserve abArray(t)

    abArray(t) = Hex(Counter)

    t = t + 1
    count = count + 1

    Exit Do ' Exit inner loop.

    End If


    Loop
    Close #14

    'If count > 30160 Then
    ' MsgBox ("ok")
    'End If


    Loop
    p = 0
    For t = LBound(abArray) To UBound(abArray)
    p = abArray(t)
    g = Len(p)
    If g = 1 Then
    Print #13, "0" & p
    Else
    If t = 1790 Then
    MsgBox ("ok")
    End If
    Print #13, abArray(t)
    End If
    Next t


    Set pnlX = Form1.StatusBar 1.Panels(3)
    pnlX = "Generation of Family Keys Complete"

    ErrorHandler:
    On Error Resume Next

    Close #3

    End Sub
Working...