Destructor TFileRecord.Destroy; Begin If Assigned(FStream) Then FStream.Free; Inherited; End;
Function TFileRecord.EOF: Boolean; Begin If Assigned(FStream) Then
Result:=FStream.Position>=FStream.Size Else
Result:=True; End;
Function TFileRecord.FileSize: Integer; Begin If Assigned(FStream) Then
Result:=FStream.Size Div FTaille Else
Result:=0; End;
Procedure TFileRecord.Reset; Begin If Assigned(FStream) Then FreeAndNil(FStream); If FNom<>'' Then FStream:=TFileStream.Create(FNom,fmOpenReadWrite); End;
Procedure TFileRecord.ReWrite; Begin If Assigned(FStream) Then FreeAndNil(FStream); If FNom<>'' Then FStream:=TFileStream.Create(FNom,fmCreate); End;
Procedure TFileRecord.Seek(N: Integer); Begin If Assigned(FStream) Then
FStream.Position:=N*FTaille; End;
Procedure TFileRecord.CloseFile; Begin If Assigned(FStream) Then FreeAndNil(FStream); End;
Procedure TFileRecord.ReadShortString(Var Chaine:ShortString;Longueur:Integer); Var Buffer:ArrayOf Byte;
i:Integer; Begin
SetLength(Buffer,Longueur+1);
FStream.ReadBuffer(Buffer,Longueur+1);
Chaine:=''; For i:=1 To Buffer[0] Do Chaine := Chaine+AnsiChar(Buffer[i]); End;
Procedure TFileRecord.WriteShortString(Const Chaine: ShortString;Longueur: Integer); Var Buffer:ArrayOf Byte;
i:Integer; Begin
SetLength(Buffer,Longueur+1); For i:=0 To Longueur Do Buffer[i]:=Byte(Chaine[i]);
FStream.WriteBuffer(Buffer,Longueur+1); End;