c++builder 获取程序当前路径

//获取当前路径
string __fastcall TForm1::GetAppPath(){
  char apppath[MAX_PATH] = {0} ;
  string tmppath = "";
  GetModuleFileNameA(NULL,apppath,MAX_PATH) ;
  tmppath = (string)apppath;
  tmppath = tmppath.replace(tmppath.find("\\.\\"),3,"\\");
  return tmppath;
}


string ss =  Form1->GetAppPath();
  Memo1->Lines->Add(ss.data());

 

你可能感兴趣的:(c++builder 获取程序当前路径)