关于DELPHI访问文件的问题!
procedure TForm1.N3Click(Sender: TObject);
var
searchstr,textstr,textstr1,textstr2,textstr3,textstr4,textstr5,textstr6,textstr7:string;
i:integer;
scorestr:string;
xlsdir:string;
datatext:Textfile;
searchtext:Textfile;
begin
textstr1:='';
textstr2:='';
textstr3:='';
textstr4:='';
textstr5:='';
textstr6:='';
textstr7:='';
i:=1;
AssignFile(datatext,form1.OpenDialog1.filename);
reset(datatext);
while not(eof(datatext)) do
begin
readln(datatext,textstr);
if (i=1) then
begin
datastr:=textstr;
i:=i+1;
end
else
begin
strchang(textstr,textstr1,textstr2,textstr3,textstr4,textstr5,textstr6,textstr7);
searchstr:=textstr3;
xlsdir:=textstr1;
scorestr:=textstr2;
form1.Edit1.Text:=scorestr;
textstr:='';
textstr1:='';
textstr2:='';
textstr3:='';
textstr4:='';
textstr5:='';
textstr6:='';
textstr7:='';
assignfile(searchtext,scorestr);
# reset(searchtext);
while not(eof(searchtext)) do
begin
readln(searchtext,textstr);
strchang(textstr,textstr1,textstr2,textstr3,textstr4,textstr5,textstr6,textstr7);
form1.Edit1.Text:=textstr1;
end;
closefile(searchtext);
i:=i+1;
end;
end;
closefile(datatext);
end;
上面是我一个菜单的程序,一编译就停在了# reset(searchtext);
这个位置,说I/O出错了 ,这个是为什么呢?
难道不能同时访问两个文件????