Connect with Expertise | Find Experts, Get Answers, Share Insights

Running a C++ Program during the execution of a C Program

 
Join Date: Feb 2010
Posts: 2
#1: Feb 9 '10
Hello,

This is my first time posting on this thread. I was just wondering if anyone had any idea if it is possible to call a C++ program inside the code of a C program.

Also, I need to pass a few variables of the C program into the C++ program. I was also wondering if this is at all possible. I was thinking of just writing the variables to a file from the C program, and reading the variable from the C++ program. But it would be much easier to send them directly.

Thanks!

 
Join Date: Feb 2010
Posts: 2
#2: Feb 9 '10

re: Running a C++ Program during the execution of a C Program


If it helps to know, I am running on Fedora 7 with a standard gcc compiler.

I understand that there are shell commands that I can implement inside my C program, such as system calls, I am just not sure what those look like.

At this point, I am leaning towards writing and reading my variables to a file that can be read by both programs.
Banfa's Avatar
E
M
C
 
Join Date: Feb 2006
Location: South West UK
Posts: 7,174
#3: Feb 10 '10

re: Running a C++ Program during the execution of a C Program


Look up the standard library call

system(const char *)

in you documentation. You can put variable values on the command line.
Reply

Tags
c++, execution, program