J
jbas
Unregistered / Unconfirmed
GUEST, unregistred user!
下面的代码为什么会错?
//从文件读记录,以string数组的类型返回。
function TFrmSrvCfg.ReadCfgFile(FFile: string):tstrings;
var
CmtNeFile:TEXTFILE;
FileListStr:string;
Stigs:TStrings;
begin
try
Stigs:=TStrings.Create;
Assignfile(CmtNeFile,FFile);
if not fileexists(FFile) then
rewrite(CmtNeFile);
reset(CmtNeFile);
try
while not eof(CmtNeFile) do
begin
readln(CmtNeFile,FileListStr);
Stigs.Add(FileListStr);
end;
result:=Stigs;
finally
closefile(CmtNeFile);
end;
finally
Stigs.Free;
end;
end;
//调用这个函数.
Cflist:=Tstrings.create;
CfList:=ReadCfgFile(Glb_File);
CmbBxCmpNe.Items:=CfList;
LstBxCmt.Items:=CfList;
CfList.Free;
CmbBxCmpNe.ItemIndex:=0;
end;
//从文件读记录,以string数组的类型返回。
function TFrmSrvCfg.ReadCfgFile(FFile: string):tstrings;
var
CmtNeFile:TEXTFILE;
FileListStr:string;
Stigs:TStrings;
begin
try
Stigs:=TStrings.Create;
Assignfile(CmtNeFile,FFile);
if not fileexists(FFile) then
rewrite(CmtNeFile);
reset(CmtNeFile);
try
while not eof(CmtNeFile) do
begin
readln(CmtNeFile,FileListStr);
Stigs.Add(FileListStr);
end;
result:=Stigs;
finally
closefile(CmtNeFile);
end;
finally
Stigs.Free;
end;
end;
//调用这个函数.
Cflist:=Tstrings.create;
CfList:=ReadCfgFile(Glb_File);
CmbBxCmpNe.Items:=CfList;
LstBxCmt.Items:=CfList;
CfList.Free;
CmbBxCmpNe.ItemIndex:=0;
end;