Launching another application through c++ code [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to know if there is a way to launch an application through a c++ code? As if I was launching it through the command line (with giving parameters for example).
If it exists, please can you provide me with both the windows code as well as linux code (in case they differ).

You can use system calls, like:
exec()
fork()
You can find plenty of examples. I had also answered a question about fork() here.
For exec(), you could read this: Please explain exec() function and its family.

For Windows, you can use one of the spawn family of functions, like _wspawnl. For Linux, you can use one of the exec family of functions, in combination with fork, like execl.

Related

How to detect and communicate with another process under Linux? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a program 'P' and P is executed in terminal A. Let's call it process A. While process A is running, terminal B is opened and executes P as process B.
How can I make process A find process B and exchange data with each other? Someone told me to implement it with MPI but I haven't found any material telling me how.
I also appreciate that if anyone can tell me how to make these two process read and write the same variable (same address in memory). This solves my problem, too.
There are lots of options, but in most cases I think you'll find that named pipes/fifo will meet your needs.
See mkfifo, which creates a named pipe on the filesystem; that pipe can then be opened and accessed using standard open/read/write like a file for interprocess communications.

Create timer queue in Linux using C++ [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have implemented a project in Windows using C++ that creates a timer queue, add entries to it, perform a callback function when the timer expires,waits for next timer, etc. It was possible using the Windows functions CreateTimer, CreateTimerQueueTimer, CreateTimer,etc.
Now my question is how to do the same thing in Linux using C++? Is there some API ? Is timer_create a good option for doing this? It will be much helpful if an example is also provided.
Can't you use libevent for this ?

Is there a GetModuleThreadId function? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Problem: Windows platform.
dll_1 in a process needs to know the thread id
of dll_2 in the same process.
dll_1 already has the hmodule of dll_2.
Although it may seem a trivial task there is no
documentation at all on how this can achieved.
You would think there would be a function such
as GetRemoteModuleThreadId() but if there is then it has been
concealed for security reasons.
A thread and a DLL are distinct and unrelated concepts. A DLL is just "some code that has been loaded into the process's memory" and a thread is a distinct sequence of code execution that happens to execute code, whether it's in the main exe or a DLL.

If I wanted to create a GUI for wget in c++.. where would I start? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Question is the title.
I'm sorry, I suppose I need to specify.
I'm not sure what commands or what code to use to actually link wget to a gui.
I have two weeks until classes start and I just want to Create something.
Maybe here and here. There are numerous widget toolkits for C++.
Since wget is not a HTTP library, but an application, calling this using system() or similar calls is disrecommended.
I advise you to use a HTTP C/C++ library.

Catching informations about running processes in Windows [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My task is to make a program, which counts a time of running processes in windows. Can you suggest me how or from where can I catch that informations?
For list of currently running processes under Windows use EnumProcesses win32 API
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682629%28v=vs.85%29.aspx
example how to do this:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682623%28v=vs.85%29.aspx
From your question I'm not sure if you need process timing information (CPU time,etc.) or to count instances of given process in memory. Could you please explain this more clearly ?
You can use GetProcessTimes function to get process timing information.