Einzelnen Beitrag anzeigen

mandoza

Registriert seit: 27. Apr 2018
16 Beiträge
 
#4

AW: Update/Delete Record items in a Stream

  Alt 27. Apr 2018, 12:09
Why not define a specialized list?
Delphi-Quellcode:
uses ..., System.Generics.Collections;

type
  TMyRecList = class(TList<Tmyrecord>)
  public
    procedure LoadFromFile(const Filename: string);
    procedure SaveToFile(const Filename: string);
  end;
Thank you , but what i wanted is to be able to update / delete items from my record then save / read again .
please read the

Delphi-Quellcode:
procedure UpdateMyRecLastName(NewLastName:string);
var
  LoadingStream: TFileStream;
  i, j: Integer;
  myRec:Tmyrecord;
begin
  SavingStream := TFileStream.Create('SAVE.test', fmCreate or fmOpenWrite or fmShareDenyWrite);
  try
      
       myRec.LastName:=NewLastName;
      
      {
    Here how to update myRec.LastName value in the LoadingStream
      }

    
  finally
    SavingStream.Free;
  end;
end;

procedure DeleteMyRecLastName();
var
  LoadingStream: TFileStream;
  i, j: Integer;
  myRec:Tmyrecord;
begin
  SavingStream := TFileStream.Create('SAVE.test', fmCreate or fmOpenWrite or fmShareDenyWrite);
  try
      {
    Here how to Delete myRec.LastName value in the LoadingStream
      }

    
  finally
    SavingStream.Free;
  end;
end;
  Mit Zitat antworten Zitat