OK, I replaced this line:
code:
  $string=left($string,$pos)

with this line:
code:
  $line=left($line,$pos)

and still getting a 0 for result.

entire code:
code:
 
$file="%temp%\text.txt"
$string="*"
$length=len($string)
$count=0
$=open(1,$file,1)
$line=readline(1)
while @error=0
:lookagain
$pos=instrrev($line,$string)
if $pos
$count=$count+1
;$string=left($string,$pos)
$line=left($line,$pos)
goto lookagain
endif
$line=readline(1)
loop
$=close(1)
? $count



[ 07 June 2002, 00:52: Message edited by: Jake ]