2012-02-03 8 views
2

나는 QProcess을 포함하는 8 개의 다른 '하위 함수'를 실행하는 함수 A()을 가지고 있습니다. 모든 QProcesses에서 리턴 코드를 얻으려면 어떻게해야합니까?QProcess에서 오류 코드를 가져 오는 방법은 무엇입니까?

예 : 나는 this example을 발견하지만 난 내 응용 프로그램에서 포인터 객체를 사용하기 때문에 그것을 자신을 구현하는 방법을 이해하지

void Mainclass::A() 
{ 
    B(); 
    C(); 
    // ... 
    I(); 
} 

void Mainclass::B() 
{ 
    QString CommandPath = "PathB"; 
    QProcess *Process = new QProcess(this); 

    Process->setWorkingDirectory(MainDir); 
    Process->setStandardOutputFile(MainDir + "/geometries"); 
    Process->start(CommandPath); 
    Process->waitForFinished(); 
    QProcess::ExitStatus Status = Process->exitStatus(); 

    if (Status == 0) 
    { 
     std::cout << "App executed!" << std::endl; 
    } 
} 

.

+0

Qprocess 클래스에 exitcode 멤버 변수가 있어야한다고 생각합니다. 프로세스 -> exitCode 같은 것을 볼 수 있습니까? – David

답변

5

int QProcess::exitCode() const? See.

관련 문제