标签:pat integer ctf rac RoCE delphi mst set function
function get_dir_parent(dir:string;n:integer):string; //n为几级父目录
var
st:string;
i:integer;
begin
st:=GetCurrentDir;
SetCurrentDir(dir);
for i:=1 to n do
begin
ChDir(‘..‘);
end;
result:=GetCurrentDir;
SetCurrentDir(st);//恢复最初
end;
调用
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage(get_dir_parent((ExtractFilePath(ParamStr(0))),1));
end;
标签:pat integer ctf rac RoCE delphi mst set function
原文地址:https://www.cnblogs.com/tc310/p/11558797.html