Author Topic: Scan through file  (Read 969 times)

0 Members and 1 Guest are viewing this topic.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Scan through file
« on: May 13, 2007, 02:42:09 pm »
I have the following code scan through a file, CashSpot.txt. Spot should be -1 if your name is not in there, but if it is, then Spot will = the number of lines down you are where as the first line is 0.

Quote from: DorkeyDear
      File := XSplit(ReadFile('CashSpot.txt'),chr(10) + chr(13));
      Spot := -1;
      i := 0
      while (i <> Spot) and (i <= ArrayHigh(File)) do begin
        if Copy(File,1,Length(IDtoName(ID))) = IDtoName(ID) then Spot := i;
        i := i + 1;
      end;

It works with 0 or 1 person in the list, but not 2 for some reason. Please help.
« Last Edit: May 13, 2007, 03:32:57 pm by DorkeyDear »

Offline DeMo

  • Soldier
  • **
  • Posts: 127
  • Stay Metal! \m/
    • Encoder 2002
Re: Scan through file
« Reply #1 on: May 13, 2007, 03:20:11 pm »
Looks like you're missing a ; in the 3rd line.

<@Evil-Ville> Expect a picture of Chakra` holding his fleshlight soon!