title: Run external .exe and receive return value from it
body: <p>In C++ is it possible to call/run another executable and receive a return value from that executable(for example either a 1 or 0 to signify whether the other exe performed its operations successfully)? </p>
  
  <p>For simplicity, take this example, if I have an external console .exe called filelist.exe that lists all files in a directory and writes those file names to a file. If the filelist.exe runs successfully then main returns 1 and if not returns 0. </p>
  
  <p>If I were to run filelist.exe using the following code, is there a way to get a return value from filelist.exe?</p>
  
  <pre><code>int res = system("filelist.exe dirPath");
  
  // Maybe the windows function CreateProcess() allows filelist.exe to return
  // a value to the currently running application?
  CreateProcess();
  </code></pre>
  
  <p>Note I am not intending to create a simple console application that lists files in a directory I am attempting to create a console application that checks whether the user has a valid version of a 3rd party program and return 1 if they do have a valid version and 0 if not. </p>