delphi 运行时报错:Cannot open file "E:\prpdata\10条数据从1开始"

来源:百度知道 编辑:UC知道 时间:2024/07/03 04:47:45
出现问题的源码:
for i := 1 to filecount do // 循环处理文件
begin
//处理单个文件的
strL:= Tstringlist.Create;

strl.Clear;
strl.LoadFromFile(fileallpath.text+'\'+string(filename_array[i]));
//strl.LoadFromFile(fileGpath.text+'\'+filegcount.text+'条数据'+'从'+DataBeginNum.Text+'开始\'+string(filename_array[i]));
//如果文件中无内容在在目标路径创建空的文件

if strl.Count=0 then
begin
FileHandle:=filecreate(fileGpath.text+'\'+filegcount.text+'条数据'+'从'+DataBeginNum.Text+'开始\'+string(filename_array[i]));
fileclose(filehandle);
end
else
begin
//处理单文件
//获取行数:temp_array[0]
//获取行数内容 temp_array[1..temp_array[0]]
//处理单行和多行的情况。
format_q(temp_array,500);
temp_array[0]:=inttostr(strl.count); //获取文件行数。

系统自动定位到了“if strl.Count=0 then”这一行

请各位大虾指点一二

strl.LoadFromFile(fileallpath.text+'\'+string(filename_array[i]));
关键是这句,要确保你的磁盘上否存在此份文件,如果不存在,那载入时肯定是会报错的