eof() problem
Posted: Fri Sep 12, 2008 6:54 pm
				
				Hi, I am accessing a text file with readfile() and then reading strings one by one which I am writing to another text file.  However, the program seemingly runs forever, never getting out of the While/Wend section, as if there is no end to the original file:
Any ideas what I'm doing wrong?
Thanks!
			Code: Select all
    While Eof(#ORIGINAL) = 0
      
      Repeat
        current_string$ = ReadString(#ORIGINAL)
        WriteStringN(#SHUFFLED, current_string$)
      Until current_string$ = "    <ITEM"
      
      position.f = ValF(RemoveString(ReadString(#ORIGINAL), "      POSITION "))
      length.f = ValF(RemoveString(ReadString(#ORIGINAL), "      LENGTH "))
      
      If counter = 0
        WriteStringN(#SHUFFLED, "      POSITION " + StrF(position.f))
        WriteStringN(#SHUFFLED, "      LENGTH " + StrF(length.f))
        new_position.f = prev_position.f + prev_length.f
        counter = 1
      Else
        WriteStringN(#SHUFFLED, "      POSITION " + StrF(new_position.f))
        WriteStringN(#SHUFFLED, "      LENGTH " + StrF(length.f))
        new_position.f = prev_position.f + prev_length.f + ValF(GetGadgetText(#SPACING))
      EndIf
      
      prev_position.f = new_position.f
      prev_length.f = length.f
      
    WendThanks!