K kingdom Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-01 #1 将文本文件用loadfromfile 至Tmemorystream,我想将字符串从中读出,用TStringStream,该怎么做?有没有BinaryToText这样的东东?
A agang_yao Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-01 #2 S := TStringStream.Create(''); S.LoadFromFile(TxtFileName); str := S.DataString; S.Free;
T TYZhang Unregistered / Unconfirmed GUEST, unregistred user! 2001-06-01 #3 用TStringList吧: Var L:TStringList; I:Integer; begin if OpenDialog1.Execute then begin L:=TStringList.Create; L.LoadFromFile(OpenDialog1.fileName); Try For I:=0 To L.Count-1 do Memo1.Lines.Add(L.Strings); Finally L.Free; end; end; end;
用TStringList吧: Var L:TStringList; I:Integer; begin if OpenDialog1.Execute then begin L:=TStringList.Create; L.LoadFromFile(OpenDialog1.fileName); Try For I:=0 To L.Count-1 do Memo1.Lines.Add(L.Strings); Finally L.Free; end; end; end;