我有以下函数,希望能告诉我文件夹是否存在,但是当我调用它时,我得到了这个错误 -
无法将参数 1 从 'System::String ^' 转换为 'std::string'
功能 -
#include <sys/stat.h>
#include <string>
bool directory_exists(std::string path){
struct stat fileinfo;
return !stat(path.c_str(), &fileinfo);
}
调用(来自包含用户选择文件夹的表单的 form.h 文件) -
private:
System::Void radioListFiles_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
if(directory_exists(txtActionFolder->Text)){
this->btnFinish->Enabled = true;
}
}
有人能告诉我如何解决这个问题吗?谢谢。