0
config 파일을 읽고 디렉토리를 얻는 C++ 프로그램이 있습니다. 지금하고 싶은 것은 설정 파일의 디렉토리 설정을 사용하여 .exe 프로그램을 실행하는 것입니다. 에서 ShellExecute 내부std :: cout에서 .exe를 실행하려고 시도했습니다.
int main(){
ConfigFile cfg("htbaseconfig.properties");
bool exists = cfg.keyExists("backuplocation");
exists = cfg.keyExists("logdir");
exists = cfg.keyExists("execdir");
exists = cfg.keyExists("fulldir");
exists = cfg.keyExists("incdir");
exists = cfg.keyExists("appdir");
std::string bkploc = cfg.getValueOfKey<std::string>("backuplocation");
std::cout << "Backup Location: " << bkploc << "\n";
std::string bkplogdir = cfg.getValueOfKey<std::string>("logdir");
std::cout << "Log Location: " << bkplogdir << "\n";
std::string bkpexec = cfg.getValueOfKey<std::string>("execdir");
std::cout << "Exec Directory: " << bkpexec << "\n";
std::string bkpfulldir = cfg.getValueOfKey<std::string>("fulldir");
std::cout << "Full Directory: " << bkpfulldir << "\n";
std::string bkpappdir = cfg.getValueOfKey<std::string>("appdir");
std::cout << "Real app Directory: " << bkpappdir << "\n\n\n";
for(; ;) {
Sleep(6000);
ShellExecute(NULL, L"open", , L"C:\\teste.htm", NULL,SW_SHOWNORMAL);
}
std::cin.get();
return (0);}
, 나는 설정 옵션을 구문 분석 다음 줄을 실행하고 싶었 : :이 어떻게해야합니까
$execdir/program.exe $logdir/log.txt $bkpappdir $bkploc
을 여기
내 코드의 조각인가? 내가 가진 변수를 가진 프로그램을 실행하고 싶습니다std::cout
.
'표준 : string's가 연결될 수있는 다른 EXE 파일에서 구문 분석 (또는 구문 분석하는 방법) 방법에 따라 달라집니다 'std :: wstring's로 작업해야한다는 점에서 문제가 생길 것입니다. –