Results 1 to 17 of 17

Thread: My Big Problem....

Hybrid View

  1. #1
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863

    Re: My Big Problem....

    I Have no idea why the testoutfile.txt should be empty.
    There is a mistake in the code, it uses all lines with "solution" imnstead of those without.

    I changed it:
    VB Code:
    1. Dim DatNr1 As Integer
    2.     Dim DatNr2 As Integer
    3.     Dim strTextLine As String
    4.     Dim ret As Integer
    5.     DatNr1 = FreeFile
    6.     Open "outfile.txt" For Input As DatNr1
    7.     DatNr2 = FreeFile
    8.     Open "testoutfile.txt" For Output As DatNr2
    9.     Do While Not EOF(DatNr1)
    10.        Input #DatNr1, strTextLine
    11.  
    12.        ret = InStr(1, LCase(strTextLine), "solution")
    13.        If ret = 0 Then
    14.           Write #DatNr2, strTextLine
    15.        Else
    16.           Write #DatNr2,
    17.        End If
    18.     Loop
    19.     Close #DatNr1
    20.     Close #DatNr2

    the resulting file I get when using your "outfile.txt" is attached!
    Last edited by opus; Jul 18th, 2007 at 02:53 AM.
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

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