Hi members!
[edited, sorry, mistake in 1st version of text ;) ]
My question is sure kind of noobish, because I want to start to develop my programming skills. I chose linux/qt as a base. But my question is more a common one:
I've got code in an existing more or less big library (*.c and *.h) and I want to get the output away from this library and have it in my gui. So the problem is, that in the library are many "printf" or even "cout".
Now I dont want to directly redirect the whole output, I want to get the strings and other data to my routine, which itself works this up and send it to the gui.
It is no problem to change the code in the library.
My Problem is in logic: how have I to implement it?! The library knows nothing from the routine in my gui-program.
My starting point is the following:
gui.h
1 2 3 4 5
|
#include <whatever>
void writeDataFromLibtoGUI(QString datafromlib);
void getIntFromLibtoGui(int dataFromLib);
....
|
Problem is in between ^^ vv
library.h
1 2 3 4 5
|
#include <whatever>
void processdata1(const char *string, int i);
void processdata2(int k);
....
|
library.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <whatever>
void processdata1(const char *string, int i){
...
printf("Data: %d",i); //--- this should be realized by writeDataFromLibtoGUI() from GUI
printf(string); //--- this should be realized by writeDataFromLibtoGUI() from GUI
...
}
void processdata2(int k){
...
k=k+123;
printf("Even more Data: %d",k); //--- this should be realized by getIntFromLibtoGui() from GUI
...
}
|
What is the clue to get both things together?! Have I to implement a kind of "interface" between them?
Sorry for that maybe simple question, but as I said - I'm a bloody beginer :)
An please no answers like "dont take qt as a beginer..." or whatsoever