title: How to get return error code of popen?
body: <p>I want the error code which return by 'popen'.</p>
  
  <p>Popen command is as below:</p>
  
  <pre><code>fp = popen("/system/bin/pgrep -f  "/system/bin/ffmpeg -loglevel quiet -re -i /data/misc/qmmf/LiveStreaming_FIFO_1.264 -codec copy -f rtsp -rtsp_transport tcp rtsp://11.11.11.11:554/live/stream1?wowzatoken=B-VDkZmspHh-G49SQIKghznGAHryq5zNc3NE7KEDgx8=" ","r");
  </code></pre>
  
  <p>I am getting the PID of the currently running ffmpeg process and am reading this popen() using a file pointer in an array. Then, read the PID(char by chat and using atoi()) and kill that PID.</p>
  
  <p>Checking the <code>(fp == NULL)</code>, but not getting NULL pointer.</p>
  
  <p>Mainly, I want to kill that ffmpeg process. Not all running ffmpeg process, but the specific one which distinguishes by its name.</p>
  
  <p>Are there any other ways apart from this?</p>
  
  <p>Any suggestions would helpful.</p>