Results 1 to 5 of 5

Thread: Trouble with text File

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2007
    Location
    Athens, Greece
    Posts
    27

    Parse Text File to an Array

    Hi Everybody,

    I need your help. I have a text file which i include in the message. As you can see this is a log file, now the problem is that i want to seperate each test that start with @Start......@ ..... and ends with @End.....@ and after that i want to put each value on differents arrays.

    example.

    Start State Reaction End State Time Stamp
    1 1 3 0,030
    3 3 5 0,060

    etc.

    I have write a code looks like this (this is a sample of the code):


    Code:
    Public Sub Simple_Reaction_Time_Shape()
    Dim ac As Single
    Dim bc, dc As Single
    Dim i As Integer
    Open App.Path & "\" & "SimpleReactionTimeShapeTemp.ini" For Output As #2
        Do While Not EOF(1) And Left(Fline, 26) <> "@Simple_Reaction_Time_End@"
            bc = ac
            
            Line Input #1, Fline
            If Left(Fline, 13) = "Start State: " Then
                Start_State = Val(Right(Fline, Len(Fline) - 13))
            Line Input #1, Fline
                Event_State = Val(Right(Fline, Len(Fline) - 10))
            Line Input #1, Fline
                End_State = Val(Right(Fline, Len(Fline) - 11))
            Line Input #1, Fline
                ac = Val(Comma2Dot(Right(Fline, Len(Fline) - 11)))
            
        End If
        
      '      Add ac, r, es, ss   Format(A(9), "#0.###")
            dc = ac - bc
            dc = Format(dc, "#0.###")
            i = i + 1
            Debug.Print i, Cand_Number, Left_Hand, Right_Hand, Date_Exam, Test_Name, Start_State, Event_State, End_State, ac, dc
            
            Print #2, i & "." & Cand_Number & "." & Left_Hand & "." & Right_Hand & "." & Date_Exam & "." & Test_Name _
            & "." & Start_State & "." & Event_State & "." & End_State & "." & ac & "." & dc
        Loop
    Close #2
    End Sub

    but i have a lot of problem because each test is difference.
    Thanks in advance for any help.
    Attached Files Attached Files

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