Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7731541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:30:19+00:00 2026-06-01T06:30:19+00:00

I am just trying to create a file with QProcess by the following source

  • 0

I am just trying to create a file with QProcess by the following source code:

void Processmethod()
{

    QDialog *ProcessMessage = new QDialog;      
    Ui::DialogProcessMessage Dialog;            
    Dialog.setupUi(ProcessMessage);             
    ProcessMessage->setModal(true);
    ProcessMessage->setAttribute(Qt::WA_DeleteOnClose); 
    ProcessMessage->show();

    processmethodONE(); 
} 

void processmethodONE()
{
    QString ProcessCommand = "w8 " + blablubli";            

    Prozess.setWorkingDirectory(Path);         //QProcess "Prozess" is globaly defined  
    Prozess.setStandardOutputFile(Path);       //in my class
    Prozess.start(ProcessCommand);

    QProcess::ExitStatus Status = Prozess.exitStatus(); 

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

This process creates out of another file which is located in the QString “Path” a new file, let me call it “PROFILE” (PRO for Problem :). The Profile also is created, but is never completed, I guess not even 50% of the file are completed.
Just when using

while(!Prozess.waitForFinished())
      {
       qApp->processEvents();
       std::cerr << "Process Create PROFile running " << std::endl;
      }

the file is written completely.
Furthermore I tried to use the QProcess finished(int) Signal to start another method and deleted the while loop (which freezes the whole GUI). I declared it in the constructor with:

connect(&Prozess, SIGNAL(finished(int)), this, (SLOT(processmethodTWO())));

But I guess this could not work because the first process isn’t finished completely. Where is the problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T06:30:20+00:00Added an answer on June 1, 2026 at 6:30 am

    There is no warranty that right after Prozess.start(ProcessCommand); process will be finished, so calling “Prozess.exitStatus();” right after it will give you “false positive”. You certainly will have to wait until process is finished. You may either do it with with while loop, that you suggested or with QEventLoop

    // ...
    Prozess.setStandardOutputFile(Path);       //in my class
    QEventLoop loop;
    connect(&Prozess, SIGNAL(error(QProcess::ProcessError)), &loop, SLOT(quit()));
    connect(&Prozess, SIGNAL(finished(int, QProcess::ExitStatus)), &loop, SLOT(quit()));
    Prozess.start();
    loop.exec();
    // Now your process status should be valid:
    QProcess::ExitStatus Status = Prozess.exitStatus();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a temp file using the following code: use File::Temp
I'm just trying to create a new MySQL database with a few simple tables.
hi i am a new java programmer. i am just trying to create a
i am just trying to create a link which execute some JavaScript in stead
This is driving me wild with frustration. I am just trying to create a
I'm not looking to harvest information, I'm just trying to create a way to
I am trying to just create a basic layout, but i am having trouble
I am trying to create a little ajax chat system (just for the heck
I'm trying to create a Custom Part that just drops text into the page.
Right now I'm trying to create my own tiny MVC (just for practice and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.