473,378 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Transfering objects between programs

I'm trying to call an executable and read an object from it. For sake
of simplicity say it's just the double "x". In my Read_Object.exe
code I can call the program with the following.

i = system ("Build_Object.exe");

Build_Object.exe creates an object that I require in the parent
program, Read_Object.exe. Is there a method to communicate between
child and parent?
If so, can you point me to it? Currently, I'm communicating via a
file.

Thanks,
Fudge
Jul 22 '05 #1
5 1322
"Daniel Fudge" <da****@oddjob.utias.utoronto.ca> wrote...
I'm trying to call an executable and read an object from it. For sake
of simplicity say it's just the double "x". In my Read_Object.exe
code I can call the program with the following.

i = system ("Build_Object.exe");

Build_Object.exe creates an object that I require in the parent
program, Read_Object.exe. Is there a method to communicate between
child and parent?
If so, can you point me to it? Currently, I'm communicating via a
file.


That's the only way available as far as standard C++ is concerned.

Some OSes offer other ways: shared memory, messaging, etc. However,
this has nothing to do with the standard c++ and therefore off-topic.
Ask in a newsgroup for your OS.

V
Jul 22 '05 #2
Daniel Fudge wrote:
I'm trying to call an executable and read an object from it. For sake
of simplicity say it's just the double "x". In my Read_Object.exe
code I can call the program with the following.

i = system ("Build_Object.exe");

Build_Object.exe creates an object that I require in the parent
program, Read_Object.exe. Is there a method to communicate between
child and parent?
If so, can you point me to it? Currently, I'm communicating via a
file.

Thanks,
Fudge


Transferring data between executables is outside the
domain of the _standard_ C++ language. Issues between
programs is the domain of the operating system. Research
newsgroups that discuss your operating system.

Also search for "pipes", "sockets", "mutexes".

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #3
"Daniel Fudge" <da****@oddjob.utias.utoronto.ca> escreveu na mensagem
news:e9**************************@posting.google.c om...
I'm trying to call an executable and read an object from it. For sake
of simplicity say it's just the double "x". In my Read_Object.exe
code I can call the program with the following.

i = system ("Build_Object.exe");

Build_Object.exe creates an object that I require in the parent
program, Read_Object.exe. Is there a method to communicate between
child and parent?
If so, can you point me to it? Currently, I'm communicating via a
file.

Thanks,
Fudge


Hi.
If you want communication between applications why don't you communicate by
sockets?
Then you can return everything you want between apps.
Jul 22 '05 #4
da****@oddjob.utias.utoronto.ca (Daniel Fudge) wrote in message news:<e9**************************@posting.google. com>...
I'm trying to call an executable and read an object from it. For sake
of simplicity say it's just the double "x". In my Read_Object.exe
code I can call the program with the following.

i = system ("Build_Object.exe");

Build_Object.exe creates an object that I require in the parent
program, Read_Object.exe. Is there a method to communicate between
child and parent?


While not strictly part of the C++ standard, it would close to 100%
portable to do this via command-line arguments, although you're still
faced with the problem of converting data to string representations:

void call_exe(double x)
{
std::stringstream args;
args << "Build_Object.exe " << x; // feed other stuff in here
int i = system(args.str().c_str());
/* do something with result */
}

//////////////////////
// code for Build_Object.exe:

int main(int argc, char* argv[])
{
if (argc > 1)
{
double x = strtof(argv[1], 0);
//
// etc.
}
}

Dylan

}
Jul 22 '05 #5
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Fudge,

This is nothing but a serialization issue in descise. A place to start
is the C++ FAQ on serialization. That being said, there are several
technologies which can solve this problem which you might have access
to. They include, but are not limited to: UNIX/IP sockets, pipes, RPC,
CORBA, etc.

From my perspective, if you are looking for something simple and quick,
try the RPC method. THis method is available on all UNIXs & is even
available on MS products under the name of DCE RPC.

Evan Carew

Daniel Fudge wrote:
I'm trying to call an executable and read an object from it. For sake
of simplicity say it's just the double "x". In my Read_Object.exe
code I can call the program with the following.

i = system ("Build_Object.exe");

Build_Object.exe creates an object that I require in the parent
program, Read_Object.exe. Is there a method to communicate between
child and parent?
If so, can you point me to it? Currently, I'm communicating via a
file.

Thanks,
Fudge


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAK455oo/Prlj9GScRAoSBAJ4g/NII9q4xJBoUUobGGRUsYccEjQCeLLiH
42yIBNKPaBmpVrfHYvG61ZQ=
=01nF
-----END PGP SIGNATURE-----
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Erich | last post by:
I have two SQL servers I am dealing with. I have some tables in one database on one SQL server that I want to transfer into a database on the other SQL server. I want to xerox copy the tables...
7
by: Ravi J | last post by:
What is the best way to transfer files between two .NET executables? I have a service, and a client program. Client asks service for data. The service creates one, and passes it back to client....
11
by: christopher diggins | last post by:
I am wondering if any can point me to any open-source library with program objects for C++ like there is in Java? I would like to be able to write things like MyProgram1 >> MyProgram2 >>...
2
by: Niyazi | last post by:
Hi, I have BIG question and I gues it is the BEST question. I have a problem that I am guessing the best solution is to create some sort ..NET Services. This Service(s) must check every...
15
by: Chris Capel | last post by:
I've heard a lot of talk on the forum about memory managment in .NET and disposing things, finalizing them, garbage collection, etc. My question is which managed types need to be disposed after...
10
by: Walshi | last post by:
Hi all, I'm a relative newby to access and VBA etc. My forms and tables etc are working great and saving lots of time...However... I have two databases with the exact same table format. I want...
2
by: ranishobha21 | last post by:
Hello, i have a program written in VC++ using MFC.i want this program to be available on WWW.can any one suggest how can i make it. Is there any tools in visual studio so that i can easily...
31
by: JoeC | last post by:
I have read books and have ideas on how to create objects. I often create my own projects and programs. They end up getting pretty complex and long. I often use objects in my programs they are...
2
by: Rob Meade | last post by:
Hi all, I have an application which enables a user to register and select a series of resources to go with their profile. At the moment I have an issue on the section where they will select...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.