WEB开发网
开发学院软件开发Delphi fileStream 阅读

fileStream

 2006-02-04 13:51:06 来源:WEB开发网   
核心提示:PRocedure TForm1.Button1Click(Sender: TObject);var f1:TFileStream; filename:String;begin OpenDialog1.Execute ; filename:=OpenDialog1.FileName ; f1:=TfileStream

PRocedure TForm1.Button1Click(Sender: TObject);
var
  f1:TFileStream;
    filename:String;
begin
  OpenDialog1.Execute ;
  filename:=OpenDialog1.FileName ;
  f1:=TfileStream.Create (filename,fmopenread);
  try
    RichEdit1.Lines.LoadFromStream(f1);
    f1.Position:=0;
    Memo1.Lines.LoadFromStream(f1);
  finally
    f1.free;
  end;

end;

procedure TForm1.Button2Click(Sender: TObject);
var f1:TFileStream;
  filename:string;
begin
  savedialog1.Execute ;
  filename:=saveDialog1.FileName ;
  f1:=TFilestream.Create (filename,FmCreate);
  try
    RichEdit1.Lines.SaveToStream (f1);

  finally
    f1.Free ;
  end;
end;

Tags:fileStream

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接