一个简单问题:如何在函数里给外部数组赋值?
我想作个给数组赋值的过程,可以这样调用:
var
myArray:array of string;
pathstr:string;
begin
pathstr='c:\test';
SetDirectName(myArray,pathstr);
showmessage(length(myArray));
end;
procedure tform1.SetDirectName(dst1:array of String ; PathName : String);
var
i:integer;
j:integer;
sr:Tsearchrec;
begin
i:=0;
j:=0;
i:=findfirst(pathname+'*.*',faanyfile,sr);
while i=0 do
begin
if (sr.name<>'.') and (sr.name<>'..') and (sr.Attr>=16) and (sr.attr<=17) then
begin
inc(j);
setlength(dst1,j);
dst1[j-1]:=sr.name;
i:=findnext(sr);
end;
end;
findclose(sr);
end;
但是在函数里面不认识这个数组参数dst1,提示未定义!
初学DELPHI,见笑了