内存流出现access violation,求高手帮助,新手在学习
本帖最后由 plmokn111 于 2014-3-27 13:52 编辑procedure TForm42.Button3Click(Sender: TObject);
var
Str,Str1: string;
Stream: TmemoryStream;
begin
Str := 'dsgdswerfwefew';
Stream := TmemoryStream.Create;
Stream.Write(str,length(Str) - 1);
Stream.Position := 0;
stream.read(Str1,stream.size);
ShowMessage(str1);
Stream.Free;
第二个问题
procedure TForm42.Button2Click(Sender: TObject); varStr: string;
Stream: TFileStream;
begin
Str := 'hello,world!';
Stream := TFileStream.Create(extractFilepath(ParamStr(0))+ '\1.txt',fmcreate);
Stream.write(Pchar(Str)^,length(Str)); FreeAndNil(Stream);
执行后,打开文件只显示有str字符串的一半 不知道为什么
delphi没学过,帮你顶起来,希望有高手看到 帮忙顶顶咯·~~~~~~~~~~~~~~~~~
页:
[1]