0

I have following code that execute .ksh successfully. My issue is, after executing ksh script, it does not return to C++ program to do my print. Therefore "ksh was executed" never gets printed. Can someone please show me what I need to do to make program comes back after executing .ksh script?
Please note reset is a .ksh.

bool System::test()
{ 
  execl("/bin/sh","/bin/sh","reset");
  print("ksh was executed \n");
  return(1);
}
2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by gerard4143
0

Please read the click below

The exec() family of functions replaces the current process image with a new process
image. The functions described in this manual page are front-ends for execve(2).
(See the manual page for execve(2) for further details about the replacement of the
current process image.)

This exert is from my help Linux files.

Edited by gerard4143: n/a

0

I didnt know this. Does this mean I should use execve(2)?

No it means any function from the exec() family will replace the current process...You can use fork() to split the process and then call a exec function in the child process or just use system().

I would investigate system() first..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.