L
linke
Unregistered / Unconfirmed
GUEST, unregistred user!
要把一个文件(无类型)的读出来,然后写入该怎么做啊?AssignFile(yf, filed); //??????????
procedure Tyazhenmdtj.LMDButton21Click(Sender: TObject);
var
s:string;
reg:tregistry;
i:integer;
a0,a1,a2,a3,a4,a5,a6,a7: string;
ff,yf:file;
bs:byte;
filed:string;
hangshu,dread:integer;
getyz:array[1..800000] of byte;
begin
Reset(yf,1);
BlockRead(yf, getyz,filesize(yf), dRead);
hangshu:=(filesize(yf)-32) div 24;
i:=1;
while (i<= hangshu) do
begin
getyz[32+(i-1)*24+15]:=strtoint(stringgrid1.cells[1,1]);
getyz[32+(i-1)*24+16]:=strtoint(stringgrid1.cells[1,3]);
getyz[32+(i-1)*24+17]:=strtoint(stringgrid1.cells[1,5]);
getyz[32+(i-1)*24+18]:=strtoint(stringgrid1.cells[1,7]);
i:=i+2;
end;
i:=2 ;
while (i<=hangshu) do
begin
getyz[32+(i-1)*24+15]:=strtoint(stringgrid1.cells[1,0]);
getyz[32+(i-1)*24+16]:=strtoint(stringgrid1.cells[1,2]);
getyz[32+(i-1)*24+17]:=strtoint(stringgrid1.cells[1,4]);
getyz[32+(i-1)*24+18]:=strtoint(stringgrid1.cells[1,6]);
i:=i+2;
end;
closefile(yf);
AssignFile(ff,filed);
Rewrite(ff,1);
for i:=1 to filesize(ff) do
begin
write(ff,getyz[1]);
end;
为什么不行呢?提示是类型不匹配
[Error] Unit2.pas(309): Incompatible types: 'procedure, untyped pointer or untyped parameter' and 'Byte'
如果用blockwrite的话,提示i/o error 103,即文件没有打开,不知道是什么原因啊。
高手帮忙指点一下。对了,如果把文件读出来修改几个数据后重新写入,一般该怎么做啊?
能不能写入到指定的位置呢?
procedure Tyazhenmdtj.LMDButton21Click(Sender: TObject);
var
s:string;
reg:tregistry;
i:integer;
a0,a1,a2,a3,a4,a5,a6,a7: string;
ff,yf:file;
bs:byte;
filed:string;
hangshu,dread:integer;
getyz:array[1..800000] of byte;
begin
Reset(yf,1);
BlockRead(yf, getyz,filesize(yf), dRead);
hangshu:=(filesize(yf)-32) div 24;
i:=1;
while (i<= hangshu) do
begin
getyz[32+(i-1)*24+15]:=strtoint(stringgrid1.cells[1,1]);
getyz[32+(i-1)*24+16]:=strtoint(stringgrid1.cells[1,3]);
getyz[32+(i-1)*24+17]:=strtoint(stringgrid1.cells[1,5]);
getyz[32+(i-1)*24+18]:=strtoint(stringgrid1.cells[1,7]);
i:=i+2;
end;
i:=2 ;
while (i<=hangshu) do
begin
getyz[32+(i-1)*24+15]:=strtoint(stringgrid1.cells[1,0]);
getyz[32+(i-1)*24+16]:=strtoint(stringgrid1.cells[1,2]);
getyz[32+(i-1)*24+17]:=strtoint(stringgrid1.cells[1,4]);
getyz[32+(i-1)*24+18]:=strtoint(stringgrid1.cells[1,6]);
i:=i+2;
end;
closefile(yf);
AssignFile(ff,filed);
Rewrite(ff,1);
for i:=1 to filesize(ff) do
begin
write(ff,getyz[1]);
end;
为什么不行呢?提示是类型不匹配
[Error] Unit2.pas(309): Incompatible types: 'procedure, untyped pointer or untyped parameter' and 'Byte'
如果用blockwrite的话,提示i/o error 103,即文件没有打开,不知道是什么原因啊。
高手帮忙指点一下。对了,如果把文件读出来修改几个数据后重新写入,一般该怎么做啊?
能不能写入到指定的位置呢?