Function with multiple output

Hi,

In my program I have a function that runs a big number of calculations and gives some output on console. Now I create a GUI, I want to modify slightly the function to make it output all its progressions, to my GUI interface, which is another function. The function in question looks like:
1
2
3
4
5
6
7
8
9
10
11
12
void Calcul() {
   cout << "Preparing calculations..." << endl;  // <- 1st output
   // local var definitions
   cout << "Running..." << endl;               // <- 2nd output
   for(int i=0; i<1000; i++) {
      // calculations done here
      cout << "Progression " << i << endl;   // <- 3rd output
      }
    cout << "Running analysis..." << endl;   // <- 4th output
    // calculations done here
    cout << "Finished." << endl;             // <- 5th output
}

It it easy to arrange these outputs on console. But quite complicated to do as to send outputs to another functions calling it (my GUI function)
I know for the loop part we can use callback. But here is mixed, I don't know how to do it. Could anyone please help me? Thanks!
Last edited on
If you're talking about a Qt application (you mentioned Qt is an earlier post?) then this might be a question for the Qt forum?

(I you're lucky, a Qt programmer will pass by, but...)

Qt forums
http://qt-project.org/forums

Probably?

General and Desktop
http://qt-project.org/forums/viewforum/10/

As this thread looks like it solving a related problem...

(seemingly) simple Qt app: creating a progress bar
http://qt-project.org/forums/viewthread/14392/P60

Andy

Well actually it's not a Qt problem. The GUI works fine. I have my program originally worked on console. Now I want it send its outputs to a function (which calls the void Calcul()) instead of send it to console via iostream. So it's basically a C++ problem.

I just need to find a good method to do so...
Topic archived. No new replies allowed.