0

I can start a process from an executable with arguments via a C++ program like this:

system("file.exe arguments")

Given a specific process (and the process that called this process (possibly via system()), if required), is there any way to find out the argument it has been called with (or, in other words, the way it has been called)?

devRicher
  • 428
  • 1
  • 7
  • 21
  • 1
    I dont get it, you are starting yourself *file.exe* and passing *arguments* as parameter, what you need to know? what *arguments* is? – ΦXocę 웃 Пepeúpa ツ Apr 12 '17 at 08:16
  • Well, *another* process started *even another process* with **arguments**, and I want to find out the **arguments** the *even another process* was called with. – devRicher Apr 12 '17 at 08:28
  • C++ has no notion of process. You need to refer to your OS API. – n. m. could be an AI Apr 12 '17 at 08:35
  • Assuming you are using Windows -- did you have a look at https://superuser.com/questions/415360/how-do-i-find-out-command-line-arguments-of-a-running-program and http://stackoverflow.com/questions/6530565/getting-another-process-command-line-in-windows ? – skalarproduktraum Apr 12 '17 at 08:37
  • @devRicher your explanation is still not very clear. You probably need to rephrase your question and give an example. – Jabberwocky Apr 12 '17 at 08:41
  • @skalarproduktraum First question perfectly explains my situation, but I'm looking on how to implement that in C++. – devRicher Apr 12 '17 at 10:51
  • @devRicher: Well, then the second question gives some ideas how to achieve that. – skalarproduktraum Apr 12 '17 at 12:03

0 Answers0