hi there everybody!
iam getting problems with this
the main thing is, by pressing Button1 i cretae, write in and read an untyped binary file, but when i press then button 3 i get an
access violation (iam using the same read method!) WHY???
I understand also good german...
----------------------------------------------------------
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var MFile:file;
var i1,tmp:integer;
begin
randomize;
AssignFile(MFile,'cisla.bin');
rewrite(MFile,SizeOf(integer));
for i1:=1 to 25 do
begin
tmp:=random(500);
BlockWrite(MFile,tmp,SizeOf(integer));
Memo1.Lines.Append(IntToStr(tmp));
end;
reset(MFile,SizeOf(integer));
while not eof(MFile) do
begin
BlockRead(MFile,tmp,SizeOf(integer));
Memo2.Lines.Append(IntToStr(tmp));
end;
CloseFile(MFile);
end;
procedure TForm1.Button3Click(Sender: TObject);
var MFile:File;
tmp:integer;
begin
AssignFile(MFile,'cisla.bin');
reset(MFile,SizeOf(integer));
while not eof(MFile) do
begin
BlockRead(MFile,tmp,SizeOf(integer));
Memo3.Lines.Append(IntToStr(tmp));
end;
closefile(MFile);
end;
----------------------------------------------------------------------