.......
Assignfile(fp1,Filename);
FileMode:=2; //R/W ACCESS
Reset(fp1);
j:=0;k:=1;
while DelLine[j]>0 do
begin
readln(fp1,con);
writeln(fp1,con1[j]); // 这里出错 I/O ERROR 105
j:=j+1;
end;
closefile(fp1);
.....
Assignfile(fp1,Filename);
FileMode:=2; //R/W ACCESS
Reset(fp1);
j:=0;k:=1;
while DelLine[j]>0 do
begin
readln(fp1,con);
writeln(fp1,con1[j]); // 这里出错 I/O ERROR 105
j:=j+1;
end;
closefile(fp1);
.....
改成
Rewrite(fp1);
Append(fp1)试试,不过好像只能加在末尾,在文件中间加没试过。
procedure TForm1.Button4Click(Sender: TObject);
var
F1: TextFile;
Ch: string;
sl: Tstringlist;
j,i: integer;
begin
sl:=tstringlist.Create;
AssignFile(F1, 'd:\1.txt');
Reset(F1);
while not Eof(F1) do
begin
Readln(F1, Ch);
sl.Add(ch);
end;
CloseFile(F1); AssignFile(F1, 'd:\1.txt');
Rewrite(F1);
for i:=0 to sl.Count-1 do
begin
Writeln(F1, sl.Strings[0]+'1');//这是我的测试使用,
end;
CloseFile(F1);end;
多谢。