Pass data between C++ programs

H

Hong

Hi Group,
I hope I got into the right place. If I have two different C++
programs (exe). Is there anyway I can pass data (numbers, strings,
etc) between the 2 programs (without combining into 1 exe)? They are
supposed to work "live", e.g. one prog picking up data from a device
and then pass it to the other prog that will analysis or use the data
for animation. And, how to do that? They are developed by two
different people, so I do not wish to combine the two programs into
one, but would be good to use one of their methods to do the work.
Any help will be appreciated.
Regards
Hong
 
V

Victor Bazarov

Hong said:
I hope I got into the right place. If I have two different C++
programs (exe). Is there anyway I can pass data (numbers, strings,
etc) between the 2 programs (without combining into 1 exe)?

Write them to a file and read the file in the other program. There
is no other way in the standard C++. All other ways are platform-
specific (shared memory, sockets, etc.)

C++ does not define interaction between processes. The language is
defined as if every program executes by itself under some kind of
"virtual machine". Inter-process communication is part of the OS (if
the OS supports the notion of a "process").

Post to a newsgroup dedicated to your OS.

Victor
 
B

Brian Wood

Hi Group,
I hope I got into the right place. If I have two different C++
programs (exe). Is there anyway I can pass data (numbers, strings,
etc) between the 2 programs (without combining into 1 exe)? They are
supposed to work "live", e.g. one prog picking up data from a device
and then pass it to the other prog that will analysis or use the data
for animation. And, how to do that? They are developed by two
different people, so I do not wish to combine the two programs into
one, but would be good to use one of their methods to do the work.
Any help will be appreciated.
Regards
Hong

I take it you can modify both programs. If that is correct, you might
be interested in the online C++ middleware generator available at
http://www.webebenezer.net. If you send the following input:

Messages
(list<int>)
(string, string)
}

as a "Middle" file, you will get a C++ class back. The class will
have
functions that send and receive instances of the types given in the
input.
You have to be careful about byte ordering when using the generated
code. (We have added support for char* and single inheritance, but
it isn't available yet on the web site. If things go as expected,
we'll update the site by the end of the month.)

Brian Wood
 
G

Guido Marx

Hi Group,
I hope I got into the right place. If I have two different C++
programs (exe). Is there anyway I can pass data (numbers, strings,
etc) between the 2 programs (without combining into 1 exe)? They are
supposed to work "live", e.g. one prog picking up data from a device
and then pass it to the other prog that will analysis or use the data
for animation. And, how to do that? They are developed by two
different people, so I do not wish to combine the two programs into
one, but would be good to use one of their methods to do the work.
Any help will be appreciated.
Regards
Hong

Using a socket is one way to do this...

Guido
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,174
Messages
2,570,940
Members
47,485
Latest member
Andrewayne909

Latest Threads

Top