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());

猜你喜欢

转载自www.cnblogs.com/iwana/p/13402951.html