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);
}

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.

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

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.