在那一句出错?for i:=1 to k-1 do
begin
check:=TStringList.Create;
check:=filecheck(dir[i]);
check.Free; //不是很明白,check起什么作用?
end;
begin
check:=TStringList.Create;
check:=filecheck(dir[i]);
check.Free; //不是很明白,check起什么作用?
end;
在 check:=filecheck(dir[i]);
后查看变量check.strings[0]出现
check.strings[0]: Delphi exception EStringListError at $655F981
我是用来测试的
看filecheck函数的返回值能不能符值过来?
请指教?
mfile.free;你都把这个StringList free掉了,也就是说filecheck返回的只是个无效的指针
当然要出错拉
你不应该在filecheck这个函数体中把mfile free掉
不释放的话
不停的create,就会内存不够
用clear好像也不行?
请帮我想想办法?
谢谢!
check:=filecheck(dir[i]);
check.Free;试试把check:=TStringList.Create去掉;
check.Free 换成filecheck.free
考虑到check在这里只是作为一个指针,所以
check:=nil;应该就没问题了
check.Free;
错误!
现在的Check没有指向对象!因为在函数体内已释放了!
在那定义呀?var form1:Tform后面?
还有mfile:=TStringList.create;
写在哪里?
但它只能运行三个文件,到第四个时出现file not found
为什么?相关代码见上面!