SCANFILE.I

[Table of Contents]

The SCANFILE.I include file resides on the Kyan Pascal 2.x Utilities Disk 1.


  • PROCEDURE Scan_File(VAR FN,Target: String15; VAR Position: Integer);


Source Code


PROCEDURE Scan_File(VAR FN,Target: String15; VAR Position: Integer);
VAR
   Result,Where,I,IX,Len: Integer;
   F: Text;
BEGIN
 Where:=1;
 Len:=0; IX:=0;
 REPEAT
    Len:=Len+1;
 UNTIL (Len=15) OR (Target[Len]=' ');
 IF Len>0 THEN
  BEGIN
   I:=1;
   Reset(F,FN);
    REPEAT
       IF Target[I]=F^ THEN I:=I+1
                       ELSE
             BEGIN
               IX:=IX+I;
               I:=1
             END;
       Get(F)
    UNTIL (EOF(F)) OR (I=Len+1);
   Where:=IX
  END;
  IF I<=Len THEN Where:=-1;
  Position:=Where
END;(* scan file *)

No comments:

Post a Comment