I have a C program, xyz.c
which does some computations on a certain variable, say transferme
. I want to transfer this variable/ pass this variable to another C program, say jkl.c
.
I have been trying to do the following:
Fork the xyz.c and use execvp() to pass this transferme
to an executable of jkl.c [Turns out execvp will accept only paths to a binary executable or a shell script.]
What is happening is,
- execvp() does not transfer variables, it needs
const char *
to be the type of the argument. - passing the path to the binary executable does not work. [I tried a simple forking and execvp, without trying to pass the variable.]
Could anyone please:
- Tell me how to use execvp() here in this case? where the binary executable is in the home folder, say the path is
/home/user/jkl.o
- Tell me how to pass this variable to the other program?
I tried looking into pipe
, but I got more confused.
EDIT: I meant jkl.out