W
wl_5545831
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm_Main.Button2Click(Sender: TObject);
var
buf:array[1..6] of byte;
tof:TFileStream;
Year,Month,Day,Hour,Min,Sec,Msec:word;
begin
DecodeDate(now,Year,Month,Day);
DecodeTime(now,Hour,Min,Sec,MSec);
Year:=Year-2000;
buf[1]:=Year;
buf[2]:=Month;
buf[3]:=Day;
buf[4]:=Hour;
buf[5]:=Min;
buf[6]:=Sec;
tof:=TFileStream.Create('test.dat',fmCreate);
tof.Position:=0;
//tof.Seek(tof.Size,0);
tof.WriteBuffer(buf,6);
tof.Free;
end;
当我点击按钮后,文件的大小只有6个字节。但是再次按下后文件没有变化。请问如何连续向文件添加记录?
var
buf:array[1..6] of byte;
tof:TFileStream;
Year,Month,Day,Hour,Min,Sec,Msec:word;
begin
DecodeDate(now,Year,Month,Day);
DecodeTime(now,Hour,Min,Sec,MSec);
Year:=Year-2000;
buf[1]:=Year;
buf[2]:=Month;
buf[3]:=Day;
buf[4]:=Hour;
buf[5]:=Min;
buf[6]:=Sec;
tof:=TFileStream.Create('test.dat',fmCreate);
tof.Position:=0;
//tof.Seek(tof.Size,0);
tof.WriteBuffer(buf,6);
tof.Free;
end;
当我点击按钮后,文件的大小只有6个字节。但是再次按下后文件没有变化。请问如何连续向文件添加记录?