Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 923723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:14:13+00:00 2026-05-15T19:14:13+00:00

I have an executable that I need to run some tests on in C++

  • 0

I have an executable that I need to run some tests on in C++ – and the testing is going to take place on all of Windows, Linux and Mac OSes.

I was hoping for input on:

  • How would I interface with the previously built executable from my code? Is there some kind of command functionality that I can use? Also, since I think the commands change between OSes, I’d need some guidance in figuring out how I could structure for all three OSes.

EDIT – Interface = I need to be able to run the executable with a command line argument from my C++ code.

  • The executable when called from the commandline also ouputs some text onto a console – how would I be able to grab that ouput stream (I’d need to record those outputted values as part of my tests).

Feel free to ask me follow up questios.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:14:13+00:00Added an answer on May 15, 2026 at 7:14 pm

    As I understand, you want to:

    1. Spawn a new process with arguments not known at runtime.
    2. Retrieve the information printed to stdout by the new process.

    Libraries such as QProcess can spawn processes, however, I would recommend doing it by hand for both Windows and MacOS/Linux as using QProcess for this case is probably overkill.

    For MacOS/Linux, here’s what I would do:

    1. Set up a pipe in the parent process. Set the read end of the pipe to a new file descriptor in the parent.
    2. fork.
    3. In newly created child process, set stdout (file descriptor #1) to the write end of the pipe.
    4. execvp in the newly created child process and pass the target executable along with what arguments you want to give it.
    5. From the parent process, wait for the child (optional).
    6. From the parent process, read from the file descriptor you indicated in Step 1.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a setup executable that I need to install. When I run it,
I have an executable that needs to run as an administrator on a Windows
I have two C DLLs that I need to access in the same executable.
I have an executable that is started by a windows service, this program will
I want to have an executable file that will call some other programs. The
I have a command line executable that alters some bits in a file that
I am modifying a Nant build script to run some unit tests. I have
I might need to write some GUI application that runs on .Net (and Windows),
I have an executable that depending on the command line switch supplied looks something
I have an executable that defaults to 32-bit. It doesn't have source code and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.