M
Marek Franke
Hello,
I have written a small program which creates a small object from a class:
---------------
#include "Object.hpp"
Object obj;
obj.init();
std::cout << obj.no << std::endl;
---------------
Result an integer stored in obj.no
Works fine and everything is OK. Now I want to start from this program a
new program with system. And with the systemcall I want to commit the
object from the 1. program to the 2. program:
--------------
// program 1
system("program2 obj");
--------------
// program 2
#include "Object.hpp"
int main(Object obj) {
std::cout << obj.no << std::endl;
}
--------------
Result: anything but not what is declared in Object::init();
How can I solve this? I think I'm on the wrong way, even with this
system("..."). I just want to create an object only one time and commit
this to program2 without creating it a second time. Is this possible in
any way?
Thank, Marek
I have written a small program which creates a small object from a class:
---------------
#include "Object.hpp"
Object obj;
obj.init();
std::cout << obj.no << std::endl;
---------------
Result an integer stored in obj.no
Works fine and everything is OK. Now I want to start from this program a
new program with system. And with the systemcall I want to commit the
object from the 1. program to the 2. program:
--------------
// program 1
system("program2 obj");
--------------
// program 2
#include "Object.hpp"
int main(Object obj) {
std::cout << obj.no << std::endl;
}
--------------
Result: anything but not what is declared in Object::init();
How can I solve this? I think I'm on the wrong way, even with this
system("..."). I just want to create an object only one time and commit
this to program2 without creating it a second time. Is this possible in
any way?
Thank, Marek