Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

513
Views
Running a Linux Executable from C/C++ Executable Without Use of system() or system() Wrappers

I am looking for a way to execute a Linux executable from a separate Linux Executable that was compiled from C or C++. However, I have looked at numerous Stack Overflow posts which all direct the user asking to use the system() function or a wrapper of the system function and I do not want a program that relies on the shell, because it could easily fall apart if it was transferred to a different operating system with a different shell.

In the post How do I execute an external program within C in Linux with arguments, the second answer states that execve() is a wrapper for the system() function, and this makes me wary of the other functions in the exec() family.

I have also looked at the following articles:

  • How do you write a C program to execute another program?
  • http://www.cplusplus.com/forum/beginner/168287/
  • Run Another Program in Linux from a C++ Program

All help is appreciated!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

execve() is not a wrapper for system(); it is a wrapper for the execve syscall itself.

execve() replaces the current process, so you’ll probably need to fork() and then execute execve() in the child process, thereby emulating the behaviour of system().

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!