One of the problems is that
if (process = 0){
must read
if (process == 0){
Otherwise, you assign zero to process
and only execl
if result
is nonzero (i.e. never).
In addition, you are trying to execute something called process.c
. There is no doubt that it may have an executable process.c
file. However, conditional names ending in .c
are passed to the C source files. If process.c
really a C file, you need to compile it and link it first.
Once you have created the executable, you need to either place it somewhere on $PATH
or indicate its full path to execle()
. In many Unix environments, placing it in the current directory will not be enough.
Finally, it is unclear that n
is in the call to execle()
, but the name alludes to a numerical variable. You must make sure that it is a string, and not, for example, an integer.
source share